0
0
mirror of https://github.com/sqlite/sqlite.git synced 2024-11-21 19:29:09 +01:00

General auto.def cleanups and docs.

FossilOrigin-Name: e2f41c2540d8ff7686bfe22336598896de9083d139fc5a291c0f19896b9c1d20
This commit is contained in:
stephan 2024-10-29 20:27:36 +00:00
parent ca698abb5a
commit e034c18591
4 changed files with 83 additions and 90 deletions

View File

@ -95,7 +95,7 @@ INSTALL = @BIN_INSTALL@
AR = @AR@
AR.flags = cr # TODO? Add a configure test to determine this?
CC = @CC@
B.cc = @BUILD_CC@ @BUILD_CFLAGS@
B.cc = @CC_FOR_BUILD@ @BUILD_CFLAGS@
T.cc = @CC@
CFLAGS = @CPPFLAGS@ @CFLAGS@ @SH_CFLAGS@

155
auto.def
View File

@ -19,14 +19,10 @@ use cc cc-db cc-shared cc-lib proj pkg-config
set DUMP_DEFINES_TXT ./config.defines.txt
# $DUMP_DEFINES_JSON is the autosetup counterpart of the historical
# "DEFS" var which was generated by the autotools in the pre-processed
# autotools builds (but not in the canonical tree). This is used by at
# least one high-profile client to extract build config info for use
# in compiling a scripting-language binding, so its name should not be
# arbitrarily changed.
#
# 2024-10-26: generation of this file is disabled (via an empty file
# name) until/unless someone voices a specific interest in it. The
# original motivating use case is handled fine by sqlite_cfg.h.
# autotools builds (but not in the canonical tree). Generation of this
# file is disabled (via an empty file name) until/unless someone
# voices a specific interest in it. The original motivating use case
# is handled fine by sqlite_cfg.h.
set DUMP_DEFINES_JSON ""; #./config.defines.json
########################################################################
@ -291,27 +287,15 @@ if {".exe" eq [get-define TARGET_EXEEXT]} {
# Programs needed
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?
#
# define BIN_INSTALL "$top_srcdir/install-sh"
#
# Nope: it MOVES its source files over the target, which breaks the
# installation in some cases, e.g. when libtclsqlite3.so is built in
# response to 'make install' and libsqlite3.a is moved before
# libtclsqlite3.so is linked. It's easy to hack to use cp instead
# of mv (simply replace the instcmd=... bit) but that won't retain
# the source timestamp and permissions unless we use cp's -p flag,
# which may not be portable enough.
}
########################################################################
# We differentiate between two C compilers: the one used for binaries
# which are to run on the build system (BUILD_CC, a.k.a. BCC) and the
# one used for compiling binaries for the target system (CC,
# a.k.a. TCC). Normally they're the same, but they will differ when
# which are to run on the build system (in autosetup it's called
# CC_FOR_BUILD and in Makefile.in it's $(B.cc)) and the one used for
# compiling binaries for the target system (CC a.k.a. $(T.cc)).
# Normally they're the same, but they will differ when
# cross-compiling.
define BUILD_CC [get-define CC_FOR_BUILD]
define BUILD_CFLAGS [get-env BUILD_CFLAGS {-g}]
########################################################################
@ -457,8 +441,8 @@ proj-if-opt-truthy with-debug {
# be empty - this tree requires TCL to generated numerous
# components.
#
define TCLSH_CMD {exit 1}
define HAVE_TCL 0
define TCLSH_CMD false ; # Significant is that it exits with non-0
define HAVE_TCL 0 ; # Will be enabled via --tcl or a successful search
proc sqlite-check-tcl {} {
# TODO: document the steps this is taking.
if {![opt-bool tcl]} {
@ -629,12 +613,21 @@ proc sqlite-check-tcl {} {
sqlite-check-tcl
########################################################################
# Check which TCL to use as a code generator. Prefer jimsh simply
# because we have it in-tree (it's part of autosetup), unless
# --with-tclsh=X is used, in which case prefix X.
# sqlite-determine-codegen-tcl checks which TCL to use as a code
# generator. By default, prefer jimsh simply because we have it
# in-tree (it's part of autosetup) unless --with-tclsh=X is used, in
# which case prefix X.
#
# Returns the name of the TCL it selects. Fails fatally if it cannot
# detect a TCL appropriate for code generation.
#
# Defines:
#
# - BTCLSH = the TCL shell used for code generation. It may set this
# to an unexpanded makefile var name.
#
# - CFLAGS_JIMSH = any flags needed for buildng a BTCLSH-compatible
# jimsh.
proc sqlite-determine-codegen-tcl {} {
msg-result "Checking for TCL to use for code generation... "
define CFLAGS_JIMSH {}
@ -669,9 +662,7 @@ proc sqlite-determine-codegen-tcl {} {
} elseif {[file-isexec "${tpre}/bin/tclsh"]} {
define TCLSH_CMD "${tpre}/bin/tclsh"
}
unset tv
}
unset tpre
}
set cgtcl [get-define TCLSH_CMD]
if {![file exists $cgtcl]} {
@ -683,7 +674,6 @@ proc sqlite-determine-codegen-tcl {} {
return $cgtcl
}; # sqlite-determine-codegen-tcl
msg-result "TCL for code generation: [sqlite-determine-codegen-tcl]"
# /TCL
########################################################################
@ -741,7 +731,9 @@ if {1} {
# - CFLAGS_READLINE = compilation flags for clients or empty string.
#
# Note that LDFLAGS_READLINE and CFLAGS_READLINE may refer to
# linenoise or editline, not necessarily libreadline.
# linenoise or editline, not necessarily libreadline. In some cases
# it will set HAVE_READLINE=1 when it's really using editline, for
# reasons described in this function's comments.
#
# Returns a string describing which line-editing approach to use, or
# "none" if no option is available.
@ -766,14 +758,14 @@ proc sqlite-check-line-editing {} {
define HAVE_EDITLINE 0
define LDFLAGS_READLINE ""
define CFLAGS_READLINE ""
set failIfNotFound 0 ; # Set to 1 for explicit --FEATURE requests when FEATURE is not found
set libsForReadline {readline edit} ; # -l names to check for readline()
set failIfNotFound 0 ; # Set to 1 for explicit --FEATURE requests
set libsForReadline {readline edit} ; # -l<LIB> names to check for readline().
# The libedit check changes this.
set editLibName "readline" ; # "readline" or "editline"
set editLibDef "HAVE_READLINE" ; # "HAVE_READLINE" or "HAVE_EDITLINE"
set check [opt-val with-linenoise]
if {"" ne $check} {
# Use linenoise...
set dirLn $check
set dirLn [opt-val with-linenoise]
if {"" ne $dirLn} {
# Use linenoise from a copy of its sources (not a library)...
if {![file isdir $dirLn]} {
proj-fatal "--with-linenoise value is not a directory"
} elseif {![file exists $dirLn/linenoise.c] } {
@ -787,16 +779,13 @@ proc sqlite-check-line-editing {} {
sqlite-add-shell-opt -DHAVE_LINENOISE=1
return "linenoise"
} elseif {[opt-bool editline]} {
# libedit mimics of libreadline and on some systems does not
# have its own header installed (instead, that of libreadline is used).
# We treat --editline as, for purposes of this tree, readline except
# that we'll link against libedit if it's available (and fail if
# it's not). We will use either API's header file
# libedit mimics libreadline and on some systems does not have its
# own header installed (instead, that of libreadline is used).
#
# shell.c historically expects HAVE_EDITLINE to be set for
# libedit, but it then expects to see <editline/readline.h>, which
# some system's don't actually have, despite having libedit. If we
# end up finding <editline/readline.h> below, we will use
# some system's don't actually have, despite having libedit. If
# we end up finding <editline/readline.h> below, we will use
# -DHAVE_EDITLINE=1, else we will use -DHAVE_READLINE=1. In either
# case, we will link against libedit.
set failIfNotFound 1
@ -806,8 +795,8 @@ proc sqlite-check-line-editing {} {
msg-result "Readline support explicitly disabled with --disable-readline"
return "none"
} elseif {[proj-opt-was-provided readline]} {
# If an explicit --enable-readline was used, fail if it's not found,
# else treat the feature as optional.
# If an explicit --[enable-]readline was used, fail if it's not
# found, else treat the feature as optional.
set failIfNotFound 1
}
@ -836,12 +825,12 @@ proc sqlite-check-line-editing {} {
if {"auto" eq $rlInc} {
set rlInc ""
if {$::cross_compiling} {
# ^^^ this check is derived from the legacy configure script
# ^^^ this check is derived from the legacy configure script.
proj-warn "Skipping check for readline.h because we're cross-compiling."
} else {
set dirs "[get-define prefix] /usr /usr/local /usr/local/readline /usr/contrib /mingw"
set subdirs "include/$editLibName"
if {"readline" ne $editLibName} {
if {"editline" eq $editLibName} {
lappend subdirs include/readline
# ^^^ editline, on some systems, does not have its own header,
# and uses libreadline's header.
@ -863,7 +852,13 @@ proc sqlite-check-line-editing {} {
}
}
# If readline.h was found/specified, look for libreadline...
# If readline.h was found/specified, look for lib(readline|edit)...
#
# This is not quite straightforward because both libreadline and
# libedit typically require some other library which (according to
# legacy autotools-generated tests) provides tgetent(3). On some
# systems that's built into libreadline/edit, on some (most?) its in
# lib[n]curses, and on some it's in libtermcap.
set rlLib ""
if {"" ne $rlInc} {
set rlLib [opt-val with-readline-ldflags]
@ -885,11 +880,12 @@ proc sqlite-check-line-editing {} {
}
}
# If we found a library, configure the build to use it...
if {"" ne $rlLib} {
if {"editline" eq $editLibName && "HAVE_READLINE" eq $editLibDef} {
proj-indented-notice {
NOTE: this is libedit but using <readline/readline.h>,
so will be compiled using -DHAVE_READLINE=1 but linked with
NOTE: the local libedit but uses <readline/readline.h> so we
will compile with -DHAVE_READLINE=1 but will link with
libedit.
}
}
@ -899,13 +895,10 @@ proc sqlite-check-line-editing {} {
define CFLAGS_READLINE $rlInc
proj-assert {expr {$editLibDef in {HAVE_READLINE HAVE_EDITLINE}}}
proj-assert {expr {$editLibName in {readline editline}}}
define $editLibDef 1
sqlite-add-shell-opt -D${editLibDef}=1
msg-result "Using $editLibName flags: $rlInc $rlLib"
# Now check whether rl_completion_matches() has a signature we can use.
# cctest is producing unexpected test output when using:
# -includes {stdio.h readline/readline.h}
# so we have to use -source instead and write the whole test app inline
# Check whether rl_completion_matches() has a signature we can use
# and disable that sub-feature if it doesn't.
if {![cctest \
-cflags "$rlInc -D${editLibDef}" -libs $rlLib -nooutput 1 -source {
#include <stdio.h>
@ -962,22 +955,6 @@ proj-if-opt-truthy math {
msg-result "Disabling math SQL functions"
}
define cross_compiling ${cross_compiling}
########################################################################
# Emscripten SDK for building the web-based wasm components.
#
set emccsh $srcdir/tool/emcc.sh
if {![get-define HAVE_WASI_SDK] && [proj-check-emsdk]} {
define EMCC_WRAPPER $emccsh
proj-make-from-dot-in $emccsh
catch {exec chmod u+x $emccsh}
} else {
define EMCC_WRAPPER ""
file delete -force $emccsh
}
unset emccsh
########################################################################
# ICU - International Components for Unicode
#
@ -988,7 +965,7 @@ unset emccsh
# --enable-icu-collations
#
# If both icu-ldflags and icu-config are provided, they are
# cumulative. If neither are provided, icu-collations is not honored
# 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
@ -1038,15 +1015,31 @@ proc sqlite-check-icu {} {
}; # sqlite-check-icu
sqlite-check-icu
########################################################################
# Emscripten SDK for building the web-based wasm components.
#
proc sqlite-check-emsdk {} {
set emccsh $::srcdir/tool/emcc.sh
if {![get-define HAVE_WASI_SDK] && [proj-check-emsdk]} {
define EMCC_WRAPPER $emccsh
proj-make-from-dot-in $emccsh
catch {exec chmod u+x $emccsh}
} else {
define EMCC_WRAPPER ""
file delete -force $emccsh
}
}
sqlite-check-emsdk
########################################################################
# Check for log(3) in libm and die with an error if it is not
# found. $why should be the feature name which requires that function
# (it's used only in error messages). defines LDFLAGS_MATH to the
# required linker flags (which may be empty even if the math APIs are
# found, depending on the OS).
proc affirm-have-math {why} {
# found. $featureName should be the feature name which requires that
# function (it's used only in error messages). defines LDFLAGS_MATH to
# the required linker flags (which may be empty even if the math APIs
# are found, depending on the OS).
proc affirm-have-math {featureName} {
if {![msg-quiet proj-check-function-in-lib log m]} {
user-error "Missing math APIs for $why"
user-error "Missing math APIs for $featureName"
}
define LDFLAGS_MATH [get-define lib_log ""]
undefine lib_log

View File

@ -1,9 +1,9 @@
C Reformulate\sthe\sreadline\scompletion\ssignature\scompatibility\stest\sso\sthat\s-Wunused-variable\sin\sthe\sCFLAGS\sdoes\snot\scause\sit\sto\sfail.\sProblem\sreported\svia\semail.
D 2024-10-29T19:03:22.644
C General\sauto.def\scleanups\sand\sdocs.
D 2024-10-29T20:27:36.141
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md c5b4009dca54d127d2d6033c22fd9cc34f53bedb6ef12c7cbaa468381c74ab28
F Makefile.in cdf1c8db0b33fa83f400bcd63742113a727517adc55b322d2e004339c012cac2
F Makefile.in 064898709d63e882764d2011522f0898c42a5dc2e7663ff4f4ed8fcfe6b7b067
F Makefile.linux-generic 69b54c58ab2424a0d30f340d9defd7e87c25690a55b77acb9bdc657bd9a223f1
F Makefile.msc a92237976eb92c5efaa0dd2524746aec12c196e12df8d4dbff9543a4648c3312
F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159
@ -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 1e6852f218b4d74fa79b2c85bbb19b3cf3b2c7c8e89225c8d639df2f0fd5a68f
F auto.def 50cf59530afe1a068fd1a981d5a12461e8acaaeff69778c0909aa1d29f1fea44
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
@ -2198,8 +2198,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 265ba15df1e64a50722118ac6d84667b0abd35fe8f4db28facf7788c50ac6cde
R e4fa5cb9421ab06b93f3a08ca998b3a0
P 3891669a3fdd71f7095cf464f6e4e2b870d6c23e79b9f796b1125b2040f05519
R da60f4bccf0dcae6e53b9b5b4cce8fd0
U stephan
Z af5ebb66ac586f10a87182e001c0a012
Z ef2b5bc13a71a0b0f34c8682ca475280
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
3891669a3fdd71f7095cf464f6e4e2b870d6c23e79b9f796b1125b2040f05519
e2f41c2540d8ff7686bfe22336598896de9083d139fc5a291c0f19896b9c1d20