#
# JimTCL: https://jim.tcl.tk
#
-use cc cc-db cc-shared cc-lib hwaci-common pkg-config
+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.
# booleans: use one of:
# - [opt-bool FLAG] is autosetup's built-in command for this, but we
# have some convenience variants:
-# - [hwaci-opt-truthy FLAG]
-# - [hwaci-opt-if-truthy FLAG {THEN} {ELSE}]
+# - [proj-opt-truthy FLAG]
+# - [proj-opt-if-truthy FLAG {THEN} {ELSE}]
#
# Non-boolean (i.e. string) flags:
# - [opt-val FLAG ?default?]
# Carry values from hidden --flag aliases over to their canonical flag
# forms.
#
-hwaci-xfer-options-aliases {
+proj-xfer-options-aliases {
with-readline-inc => with-readline-cflags
with-readline-lib => with-readline-ldflags
}
msg-result "srcdir = $srcdir"
msg-result "top_srcdir = $top_srcdir"
-msg-result [hwaci-bold "Configuring SQLite version $PACKAGE_VERSION"]
+msg-result [proj-bold "Configuring SQLite version $PACKAGE_VERSION"]
#
# SQLITE_AUTORECONFIG contains make target rules for re-running the
# Are we cross-compiling?
-set cross_compiling [hwaci-is-cross-compiling]
+set cross_compiling [proj-is-cross-compiling]
if {![file exists sqlite3.pc.in]} {
msg-result "This appears to be an out-of-tree build."
}
}
}
-hwaci-file-extensions
+proj-file-extensions
if {".exe" eq [get-define TARGET_EXEEXT]} {
define SQLITE_OS_UNIX 0
define SQLITE_OS_WIN 1
#########
# Programs needed
-if {"" eq [hwaci-bin-define install]} {
- hwaci-warn "Cannot find install binary, so 'make install' will not work."
+if {"" eq [proj-bin-define install]} {
+ proj-warn "Cannot find install binary, so 'make install' will not work."
# Reminder: we historically have ./install-sh in the source tree.
# Can we not simply use that?
#
if {$wasiSdkDir eq ""} {
return 0
} elseif {$::cross_compiling} {
- hwaci-fatal "Cannot combine --with-wasi-sdk with cross-compilation"
+ proj-fatal "Cannot combine --with-wasi-sdk with cross-compilation"
}
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}]
+ proj-affirm-files-exist -v {*}[prefix "$wasiSdkDir/bin/" {clang wasm-ld}]
msg-result "Using wasi-sdk clang, disabling: tcl, CLI shell, DLL, loadable extensions, threading"
define HAVE_WASI_SDK 1
define WASI_SDK_DIR $wasiSdkDir
- hwaci-opt-set load-extension 0 ;# ==> --disable-load-extension
- hwaci-opt-set threadsafe 0 ;# ==> --threadsafe=0
- hwaci-opt-set tcl 0 ;# ==> --disable-tcl
- hwaci-opt-set shared 0 ;# ==> --disable-shared
+ proj-opt-set load-extension 0 ;# ==> --disable-load-extension
+ proj-opt-set threadsafe 0 ;# ==> --threadsafe=0
+ proj-opt-set tcl 0 ;# ==> --disable-tcl
+ proj-opt-set shared 0 ;# ==> --disable-shared
set cross_compiling 1
# Changing --host and --target have no effect here except to possibly
cc-check-functions gmtime_r isnan localtime_r localtime_s \
malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64
-hwaci-check-function-in-lib fdatasync rt
+proj-check-function-in-lib fdatasync rt
define LDFLAGS_FDATASYNC [get-define lib_fdatasync]
undefine lib_fdatasync
# code generation:
cc-check-includes dirent.h sys/time.h
-if {[cc-check-includes zlib.h] && [hwaci-check-function-in-lib deflate z]} {
+if {[cc-check-includes zlib.h] && [proj-check-function-in-lib deflate z]} {
# TODO: port over the more sophisticated zlib search from the fossil auto.def
define HAVE_ZLIB 1; # "-DSQLITE_HAVE_ZLIB=1"
define LDFLAGS_ZLIB -lz
#
# Determine proper rpath-handling flags.
#
-hwaci-check-rpath
+proj-check-rpath
-hwaci-define-if-opt-truthy shared ENABLE_SHARED \
+proj-define-if-opt-truthy shared ENABLE_SHARED \
"Build shared library?"
-if {![hwaci-define-if-opt-truthy static ENABLE_STATIC \
+if {![proj-define-if-opt-truthy static ENABLE_STATIC \
"Build static library?"]} {
- hwaci-warn "static lib build may be implicitly re-activated by other components, e.g. libtclsqlite3."
+ proj-warn "static lib build may be implicitly re-activated by other components, e.g. libtclsqlite3."
}
-hwaci-define-if-opt-truthy amalgamation USE_AMALGAMATION \
+proj-define-if-opt-truthy amalgamation USE_AMALGAMATION \
"Use amalgamation for builds?"
-hwaci-define-if-opt-truthy gcov USE_GCOV "Use gcov?"
+proj-define-if-opt-truthy gcov USE_GCOV "Use gcov?"
-hwaci-define-if-opt-truthy test-status TSTRNNR_OPTS \
+proj-define-if-opt-truthy test-status TSTRNNR_OPTS \
"test-runner flags:" {--status} {}
-hwaci-define-if-opt-truthy linemacros AMALGAMATION_LINE_MACROS \
+proj-define-if-opt-truthy linemacros AMALGAMATION_LINE_MACROS \
"Use #line macros in the amalgamation:"
msg-checking "Debug build? "
-hwaci-if-opt-truthy with-debug {
+proj-if-opt-truthy with-debug {
define SQLITE_DEBUG 1
define TARGET_DEBUG {-g -DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0 -Wall}
msg-result yes
global top_srcdir
msg-result "Checking for a suitable tcl... "
- set optTcl [hwaci-opt-truthy tcl]
+ set optTcl [proj-opt-truthy tcl]
set use_tcl $optTcl
set with_tclsh [opt-val with-tclsh]
set with_tcl [opt-val with-tcl]
#puts "sqlite-check-tcl: with_tclsh=${with_tclsh}"
#puts "sqlite-check-tcl: with_tcl=$with_tcl"
if {"" eq $with_tclsh && "" eq $with_tcl} {
- set with_tclsh [hwaci-first-bin-of tclsh9.0 tclsh8.6 tclsh]
+ set with_tclsh [proj-first-bin-of tclsh9.0 tclsh8.6 tclsh]
}
#puts "sqlite-check-tcl: with_tclsh=${with_tclsh}"
if {"" ne $with_tclsh} {
if {![file isfile $with_tclsh]} {
- hwaci-fatal "TCL shell $with_tclsh is not a file"
+ proj-fatal "TCL shell $with_tclsh is not a file"
} elseif {![file-isexec $with_tclsh]} {
- hwaci-fatal "TCL shell $with_tclsh is not executable"
+ proj-fatal "TCL shell $with_tclsh is not executable"
} else {
define TCLSH_CMD $with_tclsh
msg-result "Using tclsh: $with_tclsh"
if {"" ne $with_tcl && [file isdir $with_tcl]} {
msg-result "$with_tclsh recommends the tclConfig.sh from $with_tcl"
} else {
- hwaci-warn "$with_tclsh is unable to recommand a tclConfig.sh"
+ proj-warn "$with_tclsh is unable to recommand a tclConfig.sh"
set use_tcl 0
}
}
}
}
if {"" eq $cfg} {
- hwaci-fatal "No tclConfig.sh found under ${with_tcl}"
+ proj-fatal "No tclConfig.sh found under ${with_tcl}"
}
} else {
# If we have not yet found a tclConfig.sh file, look in $libdir which is
}
}
if {![file readable $cfg]} {
- hwaci-indented-notice {
+ proj-indented-notice {
WARNING: Cannot find a usable tclConfig.sh file. Use
--with-tcl=DIR to specify a directory where tclConfig.sh
can be found. SQLite does not use TCL internally, but TCL
}
msg-result "Using tclConfig.sh: $cfg"
} elseif {!$optTcl} {
- hwaci-warn "Unable to run tests because of --disable-tcl"
+ proj-warn "Unable to run tests because of --disable-tcl"
} else {
- hwaci-warn "Unable to run tests because no tclConfig.sh file could be located"
+ proj-warn "Unable to run tests because no tclConfig.sh file could be located"
}
break
}
if {![file-isexec $with_tclsh]} {
set with_tclsh2 [get-define TCL_EXEC_PREFIX]/bin/tclsh
if {![file-isexec $with_tclsh2]} {
- hwaci-warn "Cannot find a usable tclsh (tried: $with_tclsh $with_tclsh2)"
+ proj-warn "Cannot find a usable tclsh (tried: $with_tclsh $with_tclsh2)"
} else {
set with_tclsh $with_tclsh2
}
}
}
} else {
- hwaci-warn "Cannot determine TCLLIBDIR"
+ proj-warn "Cannot determine TCLLIBDIR"
}
}
set tclrpath ""
}
define TCLLIBDIR $tcllibdir
define TCLLIB_RPATH $tclrpath
- #hwaci-fatal "TCLLIB_RPATH = [get-define TCLLIB_RPATH]"
+ #proj-fatal "TCLLIB_RPATH = [get-define TCLLIB_RPATH]"
} else {
define TCLLIBDIR ""
define TCLLIB_RPATH ""
msg-result "Using tclsh: $with_tclsh"
define HAVE_TCL 1
} else {
- hwaci-warn "Cannot find a usable tclsh, so cannot run tests."
+ proj-warn "Cannot find a usable tclsh, so cannot run tests."
}
}; # sqlite-check-tcl
}
set cgtcl [get-define TCLSH_CMD]
if {![file exists $cgtcl]} {
- hwaci-fatal "Cannot find a tclsh to use for code generation."
+ proj-fatal "Cannot find a tclsh to use for code generation."
}
define BTCLSH "\$(TCLSH_CMD)"
}
########################################################################
# Thread safety?
msg-checking "Support threadsafe operation? "
-hwaci-if-opt-truthy threadsafe {
+proj-if-opt-truthy threadsafe {
msg-result yes
sqlite-add-feature-flag -DSQLITE_THREADSAFE=1
- if {![hwaci-check-function-in-lib pthread_create pthread]
- || ![hwaci-check-function-in-lib pthread_mutexattr_init pthread]} {
+ if {![proj-check-function-in-lib pthread_create pthread]
+ || ![proj-check-function-in-lib pthread_mutexattr_init pthread]} {
user-error "Missing required pthread bits"
}
define LDFLAGS_PTHREAD [get-define lib_pthread_create]
# Use linenoise...
set dirLn $check
if {![file isdir $dirLn]} {
- hwaci-fatal "--with-linenoise value is not a directory"
+ proj-fatal "--with-linenoise value is not a directory"
} elseif {![file exists $dirLn/linenoise.c] } {
- hwaci-fatal "Cannot find linenoise.c in $dirLn"
+ proj-fatal "Cannot find linenoise.c in $dirLn"
} elseif {![file exists $dirLn/linenoise.h] } {
- hwaci-fatal "Cannot find linenoise.h in $dirLn"
+ proj-fatal "Cannot find linenoise.h in $dirLn"
}
msg-result "Using linenoise from $dirLn"
define CFLAGS_READLINE "-I$dirLn $dirLn/linenoise.c"
# --enable-editline to do exactly that but it seems likely to
# break on systems for which which HAVE_EDITLINE=1 previously
# worked.
- hwaci-indented-notice -error {
+ proj-indented-notice -error {
ERROR: the --enable-editline flag is not supported due to
non-availability of systems which have it in a form which the
sqlite3 CLI shell expects to see. On some systems this can be
# Transform with-readline-header=X to with-readline-cflags=-I...
set v [opt-val with-readline-header]
- hwaci-opt-set with-readline-header ""
+ proj-opt-set with-readline-header ""
if {"" ne $v} {
if {"auto" eq $v} {
- hwaci-opt-set with-readline-cflags auto
+ proj-opt-set with-readline-cflags auto
} else {
set v [file dirname $v]
if {[string match */*line $v]} {
# work!
set v [file dirname $v]
}
- hwaci-opt-set with-readline-cflags "-I$v"
+ proj-opt-set with-readline-cflags "-I$v"
}
}
set rlInc ""
if {!$::cross_compiling} {
# ^^^ this check is derived from the legacy configure script
- set rlInc [hwaci-search-for-header-dir readline.h \
+ set rlInc [proj-search-for-header-dir readline.h \
-dirs {/usr /usr/local /usr/local/readline /usr/contrib /mingw} \
-subdirs {include/readline include}]
# ^^^ The -dirs and -subdirs lists are from the legacy configure script
if {"" eq $rlLib || "auto" eq $rlLib} {
set rlLib ""
set libTerm ""
- if {[hwaci-check-function-in-lib tgetent {readline ncurses curses termcap}]} {
+ if {[proj-check-function-in-lib tgetent {readline ncurses curses termcap}]} {
# ^^^ that libs list comes from the legacy configure script ^^^
set libTerm [get-define lib_tgetent]
undefine lib_tgetent
}
if {"readline" eq $libTerm} {
set rlLib $libTerm
- } elseif {[hwaci-check-function-in-lib readline readline $libTerm]} {
+ } elseif {[proj-check-function-in-lib readline readline $libTerm]} {
set rlLib [get-define lib_readline]
lappend rlLib $libTerm
undefine lib_readline
user-notice "Readline completion enabled"
} else {
user-notice "WARNING: readline completion disabled due to rl_completion_matches() signature mismatch"
- add-shell-opt -DSQLITE_OMIT_READLINE_COMPLETION
+ sqlite-add-shell-opt -DSQLITE_OMIT_READLINE_COMPLETION
}
return "readline"
}
}; # sqlite-check-line-editing
msg-result "Line-editing support for the sqlite3 shell: [sqlite-check-line-editing]"
-hwaci-if-opt-truthy load-extension {
- if {[hwaci-check-function-in-lib dlopen dl]} {
+proj-if-opt-truthy load-extension {
+ if {[proj-check-function-in-lib dlopen dl]} {
define LDFLAGS_DLOPEN [get-define lib_dlopen]
undefine lib_dlopen
} else {
msg-result "Disabling loadable extensions."
}
-hwaci-if-opt-truthy math {
- if {![hwaci-check-function-in-lib ceil m]} {
+proj-if-opt-truthy math {
+ if {![proj-check-function-in-lib ceil m]} {
user-error "Cannot find libm functions. Use --disable-math to bypass this."
}
define LDFLAGS_MATH [get-define lib_ceil]
# Emscripten SDK for building the web-based wasm components.
#
set emccsh $srcdir/tool/emcc.sh
-if {![get-define HAVE_WASI_SDK] && [hwaci-check-emsdk]} {
+if {![get-define HAVE_WASI_SDK] && [proj-check-emsdk]} {
define EMCC_WRAPPER $emccsh
- hwaci-make-from-dot-in $emccsh
+ proj-make-from-dot-in $emccsh
catch {exec chmod u+x $emccsh}
} else {
define EMCC_WRAPPER ""
# - -licui18n -licuuc -licudata
# - -licui18n -licuuc
# - /usr/local/bin/icu-config --ldflags
- if {[hwaci-opt-was-provided with-icu-config]} {
+ if {[proj-opt-was-provided with-icu-config]} {
set bin [opt-val with-icu-config]
if {"auto" eq $bin} {
- set bin [hwaci-first-bin-of \
+ set bin [proj-first-bin-of \
[get-define prefix]/bin/icu-config \
/usr/local/bin/icu-config \
/usr/bin/icu-config]
if {"" eq $bin} {
- hwaci-fatal "--with-icu-config=auto cannot find icu-config binary"
+ proj-fatal "--with-icu-config=auto cannot find icu-config binary"
}
}
if {[file-isexec $bin]} {
set x [exec $bin --ldflags]
if {"" eq $x} {
- hwaci-fatal "$bin --ldflags returned no data"
+ proj-fatal "$bin --ldflags returned no data"
}
define-append LDFLAGS_ICU $x
} else {
- hwaci-fatal "--with-icu-config=$bin does not refer to an executable"
+ proj-fatal "--with-icu-config=$bin does not refer to an executable"
}
}
set flags [define LDFLAGS_ICU [string trim [get-define LDFLAGS_ICU]]]
# Recall that shell.c builds with sqlite3.c
}
} elseif {[opt-bool icu-collations]} {
- hwaci-warn "ignoring --enable-icu-collations because neither --with-icu-ldflags nor --with-icu-config provided any linker flags"
+ proj-warn "ignoring --enable-icu-collations because neither --with-icu-ldflags nor --with-icu-config provided any linker flags"
} else {
msg-result "ICU support is disabled."
}
# required linker flags (which may be empty even if the math APIs are
# found, depending on the OS).
proc affirm-have-math {why} {
- if {![msg-quiet hwaci-check-function-in-lib log m]} {
+ if {![msg-quiet proj-check-function-in-lib log m]} {
user-error "Missing math APIs for $why"
}
define LDFLAGS_MATH [get-define lib_log ""]
msg-result "Feature flags..."
foreach {boolFlag featureFlag ifSetEvalThis} {
all {} {
- hwaci-opt-set fts4
- hwaci-opt-set fts5
- hwaci-opt-set geopoly
- hwaci-opt-set rtree
- hwaci-opt-set session
+ proj-opt-set fts4
+ proj-opt-set fts5
+ proj-opt-set geopoly
+ proj-opt-set rtree
+ proj-opt-set session
}
fts4 -DSQLITE_ENABLE_FTS4 {affirm-have-math fts4}
fts5 -DSQLITE_ENABLE_FTS5 {affirm-have-math fts5}
- geopoly -DSQLITE_ENABLE_GEOPOLY {hwaci-opt-set rtree}
+ geopoly -DSQLITE_ENABLE_GEOPOLY {proj-opt-set rtree}
rtree -DSQLITE_ENABLE_RTREE {}
session {-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK} {}
update-limit -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT {}
memsys5 -DSQLITE_ENABLE_MEMSYS5 {}
memsys3 {} {
if {[opt-bool memsys5]} {
- hwaci-warn "not enabling memsys3 because memsys5 is enabled."
+ proj-warn "not enabling memsys3 because memsys5 is enabled."
expr 0
} else {
sqlite-add-feature-flag -DSQLITE_ENABLE_MEMSYS3
}
}
} {
- hwaci-if-opt-truthy $boolFlag {
+ proj-if-opt-truthy $boolFlag {
sqlite-add-feature-flag $featureFlag
if {0 != [eval $ifSetEvalThis] && "all" ne $boolFlag} {
msg-result " + $boolFlag"
foreach {boolFlag featureFlag} {
json -DSQLITE_OMIT_JSON
} {
- if {[hwaci-opt-truthy $boolFlag]} {
+ if {[proj-opt-truthy $boolFlag]} {
msg-result " + $boolFlag"
} else {
sqlite-add-feature-flag $featureFlag
#
# Potential TODO (unclear): in sqlite3.pc.in, do we need to include
# any CFLAGS_READLINE, CFLAGS_ZLIB, etc in its "Cflags:" section?
-hwaci-make-from-dot-in -touch Makefile sqlite3.pc
+proj-make-from-dot-in -touch Makefile sqlite3.pc
if {0} {
# Requires a hand-written sqlite_cfg.h.in...
- hwaci-make-from-dot-in sqlite_cfg.h
+ proj-make-from-dot-in sqlite_cfg.h
# vs...
} else {
# Requires no input template...
TARGET_* USE_GCOV TCL_*} \
-auto {HAVE_* PACKAGE_*} \
-none *
- hwaci-touch sqlite_cfg.h ; # help avoid frequent unnecessary @SQLITE_AUTORECONFIG@
+ proj-touch sqlite_cfg.h ; # help avoid frequent unnecessary @SQLITE_AUTORECONFIG@
}
-#TODO hwaci-make-from-dot-in ext/wasm/GNUmakefile
+#TODO proj-make-from-dot-in ext/wasm/GNUmakefile
if {"" ne $DUMP_DEFINES_JSON} {
########################################################################
-auto {OPT_* PACKAGE_* HAVE_*}
}
if {[opt-bool defines-json-include-lowercase]} {
- lappend dumpDefsOpt -none {lib_*} ; # remnants from hwaci-check-function-in-lib and friends
+ lappend dumpDefsOpt -none {lib_*} ; # remnants from proj-check-function-in-lib and friends
lappend dumpDefsOpt -auto {[a-z]*}
}
lappend dumpDefsOpt -none *
- hwaci-dump-defs-json $DUMP_DEFINES_JSON {*}$dumpDefsOpt
+ proj-dump-defs-json $DUMP_DEFINES_JSON {*}$dumpDefsOpt
undefine OPT_FEATURE_FLAGS.list
undefine OPT_SHELL.list
}
########################################################################
# Some build-dev/debug-only output
-hwaci-if-opt-truthy dump-defines {
+proj-if-opt-truthy dump-defines {
msg-result "--dump-defines is creating $::DUMP_DEFINES_TXT"
make-config-header $::DUMP_DEFINES_TXT \
-bare {SQLITE_OS* SQLITE_DEBUG USE_*} \
}
}
-msg-result [hwaci-bold "Source tree is configured! Run make to build it."]
+msg-result [proj-bold "Source tree is configured! Run make to build it."]
########################################################################
########################################################################
-# $hwaci_ is an internal-use-only array for storing whatever generic
+# $proj_ is an internal-use-only array for storing whatever generic
# internal stuff we need stored.
-array set hwaci_ {}
-set hwaci_(isatty) [isatty? stdout]
+array set proj_ {}
+set proj_(isatty) [isatty? stdout]
-proc hwaci-warn {msg} {
+proc proj-warn {msg} {
puts stderr "WARNING: $msg"
}
-proc hwaci-fatal {msg} {
+proc proj-fatal {msg} {
show-notices
puts stderr "ERROR: $msg"
exit 1
# If this function believes that the current console might support
# ANSI escape sequences then this returns $str wrapped in a sequence
# to bold that text, else it returns $str as-is.
-proc hwaci-bold {str} {
- if {$::autosetup(iswin) || !$::hwaci_(isatty)} {
+proc proj-bold {str} {
+ if {$::autosetup(iswin) || !$::proj_(isatty)} {
return $str
}
return "\033\[1m${str}\033\[0m"
#
# If its first argument is -error then it renders the message
# immediately and then exits.
-proc hwaci-indented-notice {args} {
+proc proj-indented-notice {args} {
set fErr ""
switch -exact -- [lindex $args 0] {
-error { set args [lassign $args fErr] }
########################################################################
# Returns 1 if cross-compiling, else 0.
-proc hwaci-is-cross-compiling {} {
+proc proj-is-cross-compiling {} {
return [expr {[get-define host] ne [get-define build]}]
}
########################################################################
-# hwaci-lshift_ shifts $count elements from the list named $listVar
+# proj-lshift_ shifts $count elements from the list named $listVar
# and returns them as a new list. On empty input, returns "".
#
# Modified slightly from: https://wiki.tcl-lang.org/page/lshift
-proc hwaci-lshift_ {listVar {count 1}} {
+proc proj-lshift_ {listVar {count 1}} {
upvar 1 $listVar l
if {![info exists l]} {
# make the error message show the real variable name
# out any lines which begin with an number of whitespace followed by a
# '#', and returns a value containing the [append]ed results of each
# remaining line with a \n between each.
-proc hwaci-strip-hash-comments_ {val} {
+proc proj-strip-hash-comments_ {val} {
set x {}
foreach line [split $val \n] {
if {![string match "#*" [string trimleft $line]]} {
# A proxy for cc-check-function-in-lib which "undoes" any changes that
# routine makes to the LIBS define. Returns the result of
# cc-check-function-in-lib.
-proc hwaci-check-function-in-lib {function libs {otherlibs {}}} {
+proc proj-check-function-in-lib {function libs {otherlibs {}}} {
set found 0
define-push {LIBS} {
set found [cc-check-function-in-lib $function $libs $otherlibs]
# by the -dirs {LIST} and -subdirs {LIST} flags (each of which have
# sane defaults). Returns either the first matching dir or an empty
# string. The return value does not contain the filename part.
-proc hwaci-search-for-header-dir {header args} {
+proc proj-search-for-header-dir {header args} {
set subdirs {include}
set dirs {/usr /usr/local /mingw}
# Debatable:
-# if {![hwaci-is-cross-compiling]} {
+# if {![proj-is-cross-compiling]} {
# lappend dirs [get-define prefix]
# }
while {[llength $args]} {
-dirs { set args [lassign $args - dirs] }
-subdirs { set args [lassign $args - subdirs] }
default {
- hwaci-fatal "Unhandled argument: $args"
+ proj-fatal "Unhandled argument: $args"
}
}
}
########################################################################
# If $v is true, [puts $msg] is called, else puts is not called.
-#proc hwaci-maybe-verbose {v msg} {
+#proc proj-maybe-verbose {v msg} {
# if {$v} {
# puts $msg
# }
#}
########################################################################
-# Usage: hwaci-find-executable-path ?-v? binaryName
+# Usage: proj-find-executable-path ?-v? binaryName
#
# Works similarly to autosetup's [find-executable-path $binName] but:
#
# - If the first arg is -v, it's verbose about searching, else it's quiet.
#
# Returns the full path to the result or an empty string.
-proc hwaci-find-executable-path {args} {
+proc proj-find-executable-path {args} {
set binName $args
set verbose 0
if {[lindex $args 0] eq "-v"} {
}
########################################################################
-# Uses [hwaci-find-executable-path $binName] to (verbosely) search for
+# Uses [proj-find-executable-path $binName] to (verbosely) search for
# a binary, sets a define (see below) to the result, and returns the
# result (an empty string if not found).
#
# The define'd name is: 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 {}}} {
- set check [hwaci-find-executable-path -v $binName]
+proc proj-bin-define {binName {defName {}}} {
+ set check [proj-find-executable-path -v $binName]
if {"" eq $defName} {
set defName "BIN_[string toupper [string map {- _} $binName]]"
}
}
########################################################################
-# Usage: hwaci-first-bin-of bin...
+# Usage: proj-first-bin-of bin...
#
# Looks for the first binary found of the names passed to this
# function. If a match is found, the full path to that binary is
# any define'd name that function stores for the result (because the
# caller has no sensible way of knowing which result it was unless
# they pass only a single argument).
-proc hwaci-first-bin-of {args} {
+proc proj-first-bin-of {args} {
foreach b $args {
if {[cc-path-progs $b]} {
set u [string toupper $b]
#
# TODO: move this out of this file and back into the 1 or 2 downstream
# trees which use it.
-proc hwaci-require-bash {} {
- set bash [hwaci-bin-define bash]
+proc proj-require-bash {} {
+ set bash [proj-bin-define bash]
if {"" eq $bash} {
user-error "Cannot find required bash shell"
}
# passes --foo-bar to configure, even if that invocation would resolve
# to the default value of baz. If the user does not explicitly pass in
# --foo-bar (with or without a value) then this returns 0.
-proc hwaci-opt-was-provided {key} {
+proc proj-opt-was-provided {key} {
dict exists $::autosetup(optset) $key
}
# later with [opt-val], [opt-bool], and friends.
#
# Returns $val.
-proc hwaci-opt-set {flag {val 1}} {
+proc proj-opt-set {flag {val 1}} {
global autosetup
if {$flag ni $::autosetup(options)} {
# We have to add this to autosetup(options) or else future calls
########################################################################
# Returns 1 if $val appears to be a truthy value, else returns
# 0. Truthy values are any of {1 on enabled yes}
-proc hwaci-val-truthy {val} {
+proc proj-val-truthy {val} {
expr {$val in {1 on enabled yes}}
}
########################################################################
# Returns 1 if [opt-val $flag] appears to be a truthy value or
-# [opt-bool $flag] is true. See hwaci-val-truthy.
-proc hwaci-opt-truthy {flag} {
- if {[hwaci-val-truthy [opt-val $flag]]} { return 1 }
+# [opt-bool $flag] is true. See proj-val-truthy.
+proc proj-opt-truthy {flag} {
+ if {[proj-val-truthy [opt-val $flag]]} { return 1 }
set rc 0
catch {
# opt-bool will throw if $flag is not a known boolean flag
}
########################################################################
-# If [hwaci-opt-truthy $flag] is true, eval $then, else eval $else.
-proc hwaci-if-opt-truthy {boolFlag thenScript {elseScript {}}} {
- if {[hwaci-opt-truthy $boolFlag]} {
+# If [proj-opt-truthy $flag] is true, eval $then, else eval $else.
+proc proj-if-opt-truthy {boolFlag thenScript {elseScript {}}} {
+ if {[proj-opt-truthy $boolFlag]} {
uplevel 1 $thenScript
} else {
uplevel 1 $elseScript
}
########################################################################
-# If [hwaci-opt-truthy $flag] then [define $def $iftrue] else [define
+# If [proj-opt-truthy $flag] then [define $def $iftrue] else [define
# $def $iffalse]. If $msg is not empty, output [msg-checking $msg] and
# a [msg-results ...] which corresponds to the result. Returns 1 if
# the opt-truthy check passes, else 0.
-proc hwaci-define-if-opt-truthy {flag def {msg ""} {iftrue 1} {iffalse 0}} {
+proc proj-define-if-opt-truthy {flag def {msg ""} {iftrue 1} {iffalse 0}} {
if {"" ne $msg} {
msg-checking "$msg "
}
set rcMsg ""
set rc 0
- if {[hwaci-opt-truthy $flag]} {
+ if {[proj-opt-truthy $flag]} {
define $def $iftrue
set rc 1
} else {
define $def $iffalse
}
- switch -- [hwaci-val-truthy [get-define $def]] {
+ switch -- [proj-val-truthy [get-define $def]] {
0 { set rcMsg no }
1 { set rcMsg yes }
}
########################################################################
# Args: [-v] optName defName {descr {}}
#
-# Checks [hwaci-opt-truthy $optName] and calls [define $defName X]
+# Checks [proj-opt-truthy $optName] and calls [define $defName X]
# where X is 0 for false and 1 for true. descr is an optional
# [msg-checking] argument which defaults to $defName. Returns X.
#
# If args[0] is -v then the boolean semantics are inverted: if
# the option is set, it gets define'd to 0, else 1. Returns the
# define'd value.
-proc hwaci-opt-define-bool {args} {
+proc proj-opt-define-bool {args} {
set invert 0
if {[lindex $args 0] eq "-v"} {
set invert 1
set args [lrange $args 1 end]
}
- set optName [hwaci-lshift_ args]
- set defName [hwaci-lshift_ args]
- set descr [hwaci-lshift_ args]
+ set optName [proj-lshift_ args]
+ set defName [proj-lshift_ args]
+ set descr [proj-lshift_ args]
if {"" eq $descr} {
set descr $defName
}
set rc 0
msg-checking "$descr ... "
- if {[hwaci-opt-truthy $optName]} {
+ if {[proj-opt-truthy $optName]} {
if {0 eq $invert} {
set rc 1
} else {
#
# Note that if it finds LIBLTDL it does not look for LIBDL, so will
# report only that is has LIBLTDL.
-proc hwaci-check-module-loader {} {
+proc proj-check-module-loader {} {
msg-checking "Looking for module-loader APIs... "
if {99 ne [get-define LDFLAGS_MODULE_LOADER 99]} {
if {1 eq [get-define HAVE_LIBLTDL 0]} {
}
########################################################################
-# Sets all flags which would be set by hwaci-check-module-loader to
+# Sets all flags which would be set by proj-check-module-loader to
# empty/falsy values, as if those checks had failed to find a module
# loader. Intended to be called in place of that function when
# a module loader is explicitly not desired.
-proc hwaci-no-check-module-loader {} {
+proc proj-no-check-module-loader {} {
define HAVE_LIBDL 0
define HAVE_LIBLTDL 0
define LDFLAGS_MODULE_LOADER ""
########################################################################
# Opens the given file, reads all of its content, and returns it.
-proc hwaci-file-content {fname} {
+proc proj-file-content {fname} {
set fp [open $fname r]
set rc [read $fp]
close $fp
########################################################################
# Returns the contents of the given file as an array of lines, with
# the EOL stripped from each input line.
-proc hwaci-file-content-list {fname} {
+proc proj-file-content-list {fname} {
set fp [open $fname r]
set rc {}
while { [gets $fp line] >= 0 } {
#
# 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 {}}} {
+proc proj-check-compile-commands {{configOpt {}}} {
msg-checking "compile_commands.json support... "
- if {"" ne $configOpt && ![hwaci-opt-truthy $configOpt]} {
+ if {"" ne $configOpt && ![proj-opt-truthy $configOpt]} {
msg-result "explicitly disabled"
define MAKE_COMPILATION_DB no
return 0
########################################################################
# Runs the 'touch' command on one or more files, ignoring any errors.
-proc hwaci-touch {filename} {
+proc proj-touch {filename} {
catch { exec touch {*}$filename }
}
########################################################################
# Usage:
#
-# hwaci-make-from-dot-in ?-touch? filename(s)...
+# proj-make-from-dot-in ?-touch? filename(s)...
#
# Uses [make-template] to create makefile(-like) file(s) $filename
# from $filename.in but explicitly makes the output read-only, to
# please the build process.
#
# Failures when running chmod or touch are silently ignored.
-proc hwaci-make-from-dot-in {args} {
+proc proj-make-from-dot-in {args} {
set filename $args
set touch 0
if {[lindex $args 0] eq "-touch"} {
catch { exec chmod u+w $f }
make-template $f.in $f
if {$touch} {
- hwaci-touch $f
+ proj-touch $f
}
catch { exec chmod -w $f }
}
# order to avoid potential problems with escaping, space-containing
# tokens, and interfering with autosetup's use of these vars, this
# routine does not directly modify CFLAGS or LDFLAGS.
-proc hwaci-check-profile-flag {{flagname profile}} {
- #puts "flagname=$flagname ?[hwaci-opt-truthy $flagname]?"
- if {[hwaci-opt-truthy $flagname]} {
+proc proj-check-profile-flag {{flagname profile}} {
+ #puts "flagname=$flagname ?[proj-opt-truthy $flagname]?"
+ if {[proj-opt-truthy $flagname]} {
set CC [get-define CC]
regsub {.*ccache *} $CC "" CC
# ^^^ if CC="ccache gcc" then [exec] treats "ccache gcc" as a
# machine, i.e. the local host). If $key == "build" then some
# additional checks may be performed which are not applicable when
# $key == "host".
-proc hwaci-looks-like-windows {{key host}} {
+proc proj-looks-like-windows {{key host}} {
global autosetup
switch -glob -- [get-define $key] {
*-*-ming* - *-*-cygwin - *-*-msys {
#
# TODO: have someone verify whether this is correct for the
# non-Linux/BSD platforms.
-proc hwaci-looks-like-mac {{key host}} {
+proc proj-looks-like-mac {{key host}} {
switch -glob -- [get-define $key] {
*apple* {
return 1
# build environment is then BUILD_EXEEXT is [define]'d to ".exe", else
# "". If the target, a.k.a. "host", is then TARGET_EXEEXT is
# [define]'d to ".exe", else "".
-proc hwaci-exe-extension {} {
+proc proj-exe-extension {} {
set rH ""
set rB ""
- if {[hwaci-looks-like-windows host]} {
+ if {[proj-looks-like-windows host]} {
set rH ".exe"
}
- if {[hwaci-looks-like-windows build]} {
+ if {[proj-looks-like-windows build]} {
set rB ".exe"
}
define BUILD_EXEEXT $rB
}
########################################################################
-# Works like hwaci-exe-extension except that it defines BUILD_DLLEXT
+# Works like proj-exe-extension except that it defines BUILD_DLLEXT
# and TARGET_DLLEXT to one of (.so, ,dll, .dylib).
#
# Trivia: for .dylib files, the linker needs the -dynamiclib flag
#
# TODO: have someone verify whether this is correct for the
# non-Linux/BSD platforms.
-proc hwaci-dll-extension {} {
+proc proj-dll-extension {} {
proc inner {key} {
switch -glob -- [get-define $key] {
*apple* {
}
########################################################################
-# Static-library counterpart of hwaci-dll-extension. Defines
+# Static-library counterpart of proj-dll-extension. Defines
# BUILD_LIBEXT and TARGET_LIBEXT to the conventional static library
# extension for the being-built-on resp. the target platform.
-proc hwaci-lib-extension {} {
+proc proj-lib-extension {} {
proc inner {key} {
switch -glob -- [get-define $key] {
*-*-ming* - *-*-cygwin - *-*-msys {
}
########################################################################
-# Calls all of the hwaci-*-extension functions.
-proc hwaci-file-extensions {} {
- hwaci-exe-extension
- hwaci-dll-extension
- hwaci-lib-extension
+# Calls all of the proj-*-extension functions.
+proc proj-file-extensions {} {
+ proj-exe-extension
+ proj-dll-extension
+ proj-lib-extension
}
########################################################################
# the filesystem, it fails fatally with an informative message.
# Returns the last file name it checks. If the first argument is -v
# then it emits msg-checking/msg-result messages for each file.
-proc hwaci-affirm-files-exist {args} {
+proc proj-affirm-files-exist {args} {
set rc ""
set verbose 0
if {[lindex $args 0] eq "-v"} {
# but BIN_EMCC is then emcc was not found in the EMSDK_HOME, in which
# case we have to rely on the fact that sourcing $EMSDK_ENV from a
# shell will add emcc to the $PATH.
-proc hwaci-check-emsdk {} {
+proc proj-check-emsdk {} {
set emsdkHome [opt-val with-emsdk]
define EMSDK_HOME ""
define EMSDK_ENV ""
# Achtung: we have seen platforms which report that a given option
# checked here will work but then fails at build-time, and the current
# order of checks reflects that.
-proc hwaci-check-rpath {} {
+proc proj-check-rpath {} {
set rc 1
set lp "[get-define prefix]/lib"
# If we _don't_ use cc-with {} here (to avoid updating the global
# <readline/readline.h>.
#
# Returns the value of HAVE_READLINE.
-proc hwaci-check-readline {} {
+proc proj-check-readline {} {
define HAVE_READLINE 0
define LDFLAGS_READLINE ""
define CFLAGS_READLINE ""
# Look for readline.h
set rlInc ""
- if {![hwaci-is-cross-compiling]} {
+ if {![proj-is-cross-compiling]} {
# ^^^ this check is derived from SQLite's legacy configure script
- set rlInc [hwaci-search-for-header-dir readline.h \
+ set rlInc [proj-search-for-header-dir readline.h \
-subdirs {include/readline include}]
if {"" ne $rlInc} {
if {[string match */*line $rlInc]} {
set rlLib ""
if {"" ne $rlInc} {
set libTerm ""
- if {[hwaci-check-function-in-lib tgetent {readline ncurses curses termcap}]} {
+ if {[proj-check-function-in-lib tgetent {readline ncurses curses termcap}]} {
# ^^^ check extracted from an ancient autotools configure script.
set libTerm [get-define lib_tgetent]
undefine lib_tgetent
}
if {"readline" eq $libTerm} {
set rlLib $libTerm
- } elseif {[hwaci-check-function-in-lib readline readline $libTerm]} {
+ } elseif {[proj-check-function-in-lib readline readline $libTerm]} {
set rlLib [get-define lib_readline]
lappend rlLib $libTerm
undefine lib_readline
########################################################################
-# Internal helper for hwaci-dump-defs-json. Expects to be passed a
+# Internal helper for proj-dump-defs-json. Expects to be passed a
# [define] name and the variadic $args which are passed to
-# hwaci-dump-defs-json. If it finds a pattern match for the given
+# proj-dump-defs-json. If it finds a pattern match for the given
# $name in the various $args, it returns the type flag for that $name,
# e.g. "-str" or "-bare", else returns an empty string.
-proc hwaci-defs-type_ {name spec} {
+proc proj-defs-type_ {name spec} {
foreach {type patterns} $spec {
foreach pattern $patterns {
if {[string match $pattern $name]} {
}
########################################################################
-# Internal helper for hwaci-defs-format_: returns a JSON-ish quoted
+# Internal helper for proj-defs-format_: returns a JSON-ish quoted
# form of the given (JSON) string-type values.
-proc hwaci-quote-str_ {value} {
+proc proj-quote-str_ {value} {
return \"[string map [list \\ \\\\ \" \\\"] $value]\"
}
########################################################################
-# An internal impl detail of hwaci-dump-defs-json. Requires a data
+# An internal impl detail of proj-dump-defs-json. Requires a data
# type specifier, as used by make-config-header, and a value. Returns
-# the formatted value or the value $::hwaci_(defs-skip) if the caller
+# the formatted value or the value $::proj_(defs-skip) if the caller
# should skip emitting that value.
-set hwaci_(defs-skip) "-hwaci-defs-format_ sentinel"
-proc hwaci-defs-format_ {type value} {
+set proj_(defs-skip) "-proj-defs-format_ sentinel"
+proc proj-defs-format_ {type value} {
switch -exact -- $type {
-bare {
# Just output the value unchanged
}
-none {
- set value $::hwaci_(defs-skip)
+ set value $::proj_(defs-skip)
}
-str {
- set value [hwaci-quote-str_ $value]
+ set value [proj-quote-str_ $value]
}
-auto {
# Automatically determine the type
if {![string is integer -strict $value]} {
- set value [hwaci-quote-str_ $value]
+ set value [proj-quote-str_ $value]
}
}
-array {
set ar {}
foreach v $value {
- set v [hwaci-defs-format_ -auto $v]
- if {$::hwaci_(defs-skip) ne $v} {
+ set v [proj-defs-format_ -auto $v]
+ if {$::proj_(defs-skip) ne $v} {
lappend ar $v
}
}
set value "\[ [join $ar {, }] \]"
}
"" {
- set value $::hwaci_(defs-skip)
+ set value $::proj_(defs-skip)
}
default {
- hwaci-fatal "Unknown type in hwaci-dump-defs-json: $type"
+ proj-fatal "Unknown type in proj-dump-defs-json: $type"
}
}
return $value
# Neither is especially satisfactory (and the second is useless), and
# handling of such values is subject to change if any such values ever
# _really_ need to be processed by our source trees.
-proc hwaci-dump-defs-json {file args} {
+proc proj-dump-defs-json {file args} {
file mkdir [file dirname $file]
set lines {}
lappend args -bare {SIZEOF_* HAVE_DECL_*} -auto HAVE_*
foreach n [lsort [dict keys [all-defines]]] {
- set type [hwaci-defs-type_ $n $args]
- set value [hwaci-defs-format_ $type [get-define $n]]
- if {$::hwaci_(defs-skip) ne $value} {
+ set type [proj-defs-type_ $n $args]
+ set value [proj-defs-format_ $type [get-define $n]]
+ if {$::proj_(defs-skip) ne $value} {
lappend lines "\"$n\": ${value}"
}
}
# to carry over any values from hidden aliases into their canonical
# names, so that in the above example [opt-value canonical] will
# return X if --alias=X is passed in.
-proc hwaci-xfer-options-aliases {mapping} {
- foreach {hidden - canonical} [hwaci-strip-hash-comments_ $mapping] {
- if {[hwaci-opt-was-provided $hidden]} {
- if {[hwaci-opt-was-provided $canonical]} {
- hwaci-fatal "both --$canonical and its alias --$hidden were used. Use only one or the other."
+proc proj-xfer-options-aliases {mapping} {
+ foreach {hidden - canonical} [proj-strip-hash-comments_ $mapping] {
+ if {[proj-opt-was-provided $hidden]} {
+ if {[proj-opt-was-provided $canonical]} {
+ proj-fatal "both --$canonical and its alias --$hidden were used. Use only one or the other."
} else {
- hwaci-opt-set $canonical [opt-val $hidden]
+ proj-opt-set $canonical [opt-val $hidden]
}
}
}
# Sidebar: if we do this before the cc package is installed, it gets
# reverted by that package. Ergo, the cc package init will tell the
# user "Build C compiler...cc" shortly before we tell them:
-proc hwaci-redefine-cc-for-build {} {
- if {![hwaci-is-cross-compiling]
+proc proj-redefine-cc-for-build {} {
+ if {![proj-is-cross-compiling]
&& "nope" eq [get-env CC_FOR_BUILD "nope"]
&& [get-define CC] ne [get-define CC_FOR_BUILD]} {
user-notice "Re-defining CC_FOR_BUILD to CC=[get-define CC]. To avoid this, explicitly pass CC_FOR_BUILD=..."