Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -169,5 +169,6 @@ container-stop: $(CENGINE) stop $(CNTVER) container-version: @echo $(CNTVER) +# Index: auto.def ================================================================== --- auto.def +++ auto.def @@ -29,12 +29,12 @@ fusefs=1 => {Disable the Fuse Filesystem} fossil-debug=0 => {Build with fossil debugging enabled} no-opt=0 => {Build without optimization} json=0 => {Build with fossil JSON API enabled} with-emsdk:path => {Directory containing the Emscripten SDK} - no-compile-commands=0 => - "Disable compile_commands.json support even if detected (possibly incorrectly)." + compile-commands=0 => + "Check for compile_commands.json support." } # Update the minimum required SQLite version number here, and also # in src/main.c near the sqlite3_libversion_number() call. Take care # that both places agree! @@ -745,35 +745,33 @@ # argument it is assumed to be the name of an autosetup boolean config # option to explicitly DISABLE the compile_commands.json support. # # Returns 1 if supported, else 0. Defines MAKE_COMPILATION_DB to "yes" # if supported, "no" if not. -proc check-compile-commands {{configOpt no-compile-commands}} { - 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. - 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 - } - } -} - -if {!$outOfTreeBuild} { - check-compile-commands -} else { - define MAKE_COMPILATION_DB no +proc check-compile-commands {} { + msg-checking "compile_commands.json support... " + if {[cctest -lang c -cflags {/dev/null -MJ} -source {}]} { + # This test reportedly incorrectly succeeds on one of + # Martin G.'s older systems. + 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 + } +} + +define MAKE_COMPILATION_DB no +if {!$outOfTreeBuild} { + if {[opt-bool compile-commands]} { + check-compile-commands + } else { + puts "Skipping check for compile-commands-capable compiler." + } +} else { puts "Disabling compile_commands.json check for out-of-tree build." # This is an attempt to resolve the problem reported at # https://fossil-scm.org/forum/forumpost/d19061d09a8179d0 } Index: src/main.mk ================================================================== --- src/main.mk +++ src/main.mk @@ -2174,5 +2174,6 @@ # .PHONY: all install test clean .PHONY: compile-commands-clean compile-commands-dir +#