define HAVE_EDITLINE 0
define LDFLAGS_READLINE ""
define CFLAGS_READLINE ""
+ set libsForReadline {readline edit} ; # -l names to check for readline()
set check [opt-val with-linenoise]
+ set editLibName "readline" ; # "readline" or "editline"
+ set editLibDef "HAVE_READLINE" ; # "HAVE_READLINE" or "HAVE_EDITLINE"
if {"" ne $check} {
# Use linenoise...
set dirLn $check
sqlite-add-shell-opt -DHAVE_LINENOISE=1
return "linenoise"
} elseif {[opt-bool editline]} {
- # --enable-editline. The problem is finding a system which has it
- # available to test on. The man pages for it on OpenBSD do not
- # match how shell.c uses it. OpenBSD has a lib named libedit but
- # no headers to go with it. The legacy configure script looked for
- # readline() in libedit (and libedit.a indeed has the
- # readline/history functions used by shell.c) but shell.c expects
- # to find <editline/readline.h> when HAVE_EDITLINE=1, and that
- # file is nowhere to be found.
+ # 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
#
- # However, a workaround which works on the available systems is:
- #
- # --with-readline-ldflags=-ledit
- #
- # And then let it detect readline.h. We "could" re-map
- # --enable-editline to do exactly that but it seems likely to
- # break on systems for which which HAVE_EDITLINE=1 previously
- # worked.
- 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
- worked around by passing --with-readline-ldflags=-ledit instead
- of --enable-editline, which will attempt to use the readline.h
- supplied by libreadline but link against -ledit. On systems
- tested so far, that works.
- }
- return "none"
+ # 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. Thus
+ # we trick shell.c into using editline by posing as readline.
+ set libsForReadline {edit}
+ set editLibName editline
} elseif {![opt-bool readline]} {
msg-result "Readline support explicitly disabled with --disable-readline"
return "none"
proj-opt-set with-readline-cflags auto
} else {
set v [file dirname $v]
- if {[string match */*line $v]} {
- # Special case: if the path includes .../*line/readline.h", set
+ if {[string match */readline $v]} {
+ # Special case: if the path includes .../readline/readline.h, set
# the -I to one dir up from that because our sources include
# <readline/readline.h> or <editline/readline.h>. Reminder: if
# auto.def is being run by jimsh0 then [file normalize] will not
set rlInc [opt-val with-readline-cflags auto]
if {"auto" eq $rlInc} {
set rlInc ""
- if {!$::cross_compiling} {
+ if {$::cross_compiling} {
# ^^^ 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} {
+ lappend subdirs include/readline
+ # ^^^ editline, on some systems, does not have its own header,
+ # and uses libreadline's header.
+ }
+ lappend subdirs include
+ # ^^^ The dirs and subdirs lists are, except for the inclusion
+ # of $prefix and editline, from the legacy configure script
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
+ -dirs $dirs -subdirs $subdirs]
if {"" ne $rlInc} {
- if {[string match */*line $rlInc]} {
- # See notes above for --with-readline-header
- set rlInc [file dirname $rlInc]
+ if {[string match */readline $rlInc]} {
+ set rlInc [file dirname $rlInc]; # shell #include's <readline/readline.h>
+ } elseif {[string match */editline $rlInc]} {
+ set editLibDef HAVE_EDITLINE
+ set rlInc [file dirname $rlInc]; # shell #include's <editline/readline.h>
}
set rlInc "-I${rlInc}"
}
if {"" eq $rlLib || "auto" eq $rlLib} {
set rlLib ""
set libTerm ""
- if {[proj-check-function-in-lib tgetent {readline ncurses curses termcap}]} {
+ if {[proj-check-function-in-lib tgetent "$editLibName 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} {
+ if {$editLibName eq $libTerm} {
set rlLib $libTerm
- } elseif {[proj-check-function-in-lib readline readline $libTerm]} {
+ } elseif {[proj-check-function-in-lib readline $libsForReadline $libTerm]} {
set rlLib [get-define lib_readline]
lappend rlLib $libTerm
undefine lib_readline
}
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
+ libedit.
+ }
+ }
set rlLib [join $rlLib]
set rlInc [join $rlInc]
define LDFLAGS_READLINE $rlLib
define CFLAGS_READLINE $rlInc
- define HAVE_READLINE 1
- sqlite-add-shell-opt -DHAVE_READLINE=1
- msg-result "Using readline flags: $rlInc $rlLib"
-
+ 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
- if {[cctest \
- -cflags $rlInc -libs $rlLib -nooutput 1 -source {
+ if {![cctest \
+ -cflags "$rlInc -D${editLibDef}" -libs $rlLib -nooutput 1 -source {
#include <stdio.h>
+ #ifdef HAVE_EDITLINE
+ #include <editline/readline.h>
+ #else
#include <readline/readline.h>
+ #endif
static char * rcg(const char *z, int i){return 0;}
int main(void) {
char ** x = rl_completion_matches("one", rcg);
return 0;
}
}]} {
- } else {
- user-notice "WARNING: readline completion disabled due to rl_completion_matches() signature mismatch"
+ user-notice "WARNING: readline-style completion disabled due to rl_completion_matches() signature mismatch"
show-notices
sqlite-add-shell-opt -DSQLITE_OMIT_READLINE_COMPLETION
}
-
- # 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
- if {[cctest \
- -cflags $rlInc -libs $rlLib -nooutput 1 -source {
- #include <stdio.h>
- #include <readline/readline.h>
- static char * rcg(const char *z, int i){return 0;}
- int main(void) {
- char ** x = rl_completion_matches("one", rcg);
- return 0;
- }
- }]} {
- user-notice "Readline completion enabled"
- } else {
- user-notice "WARNING: readline completion disabled due to rl_completion_matches() signature mismatch"
- sqlite-add-shell-opt -DSQLITE_OMIT_READLINE_COMPLETION
- }
- return "readline"
+ return $editLibName
}
return "none"
-C Remove\sLDFLAGS_LIBZ\sfrom\ssqlite3.pc.in\s(pkg-config)\sbecause\sit's\snot\sneeded\sby\sthe\slibrary,\sonly\sthe\sshell.\sRe-enable\sthe\snotice\sabout\s--disable-static\sonly\sbeing\spartially\strue.
-D 2024-10-29T04:21:11.440
+C Teach\sconfigure\s--editline\sto\sreport\sitself\sto\sshell.c\sas\seither\sHAVE_EDITLINE\sor\sHAVE_READLINE,\sdepending\son\swhich\sheaders\sare\savailable\s(editline/readline.h\sor\sreadline/readline.h,\sboth\sof\swhich\swork\sand\ssome\ssystems\sonly\shave\sthe\slatter),\sbut\sthen\slink\sagainst\slibedit\sregardless\sof\swhich\sone\sshell.c\sthinks\sit\sis\susing.
+D 2024-10-29T08:01:56.226
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md b6e6c1baf38e4339bd3f1e0e5e5bfd0a9a93d133360691b2785c2d4b2f2dcec2
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
-F auto.def 7f3da911883d21c53462b9a79259c9551d971a8cdc9bbbd11a7e79efaa7b758b
+F auto.def 446169b97de3492b54e2282f22cd0364a5579ec620617273c3b6e371650700ff
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
-F main.mk 35c8565133e6afc4219654a8339cf617f8d9f40b3e9b6a598a2e9782b8a4eee5
+F main.mk 46f98320780c72a025bed1a5f8af3355fb2186691617f2b8d41221f9aa564494
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 9a259026ae2dce5d60b80bd7d662a6e73734e51056f4a4226c3fa5ac636b5e3a
-R faa87ee569d92cfc3e69ecb8ae88e292
+P e03c564aff6e3ac558f17670bfdd5fc129a8d33ec50975af843973152483e3fa
+R d3a68de2e78347c35dd06cc7c4f435ff
U stephan
-Z 1c510488e46aaa36e3e65a77adda5034
+Z 03d95568b8712aa0747a4210f93cda01
# Remove this line to create a well-formed Fossil manifest.