Detect R*Tree support at compile time
Is it possible to detect if the SQLite library one compiles against has been compiled with SQLITE_ENABLE_RTREE defined? I tried grepping sqlite3.h, but I found no usable defines there.
See https://sqlite.org/pragma.html#pragma_compile_options .
That’s fine, but it does not help my compiler detect if the SQLite library I’m compiling against has rtree support. I guess I’ll have to write a shell script that can query the SQLite installation and generate a config.h file with a HAVE_RTREE define. Thanks for your reply.
(4) By Richard Damon (RichardDamon) on 2021-03-11 12:23:16 in reply to 3 [source]
Generally, these options are enabled by using a compiler flag to define this option, so unless your build system does something tricky to add it only to the compile for the library, then you can just test with something like #ifdef SQLITE_ENABLE_RTREE.
If you aren't compiling SQLite statically into the program but will be linking against a precompiled version, then this won't work, but since the library then doesn't even need to exist at compile-time, but only link time (or execute if using dynamic linking), such a test would be impossible.
I assume your desire is to figure out what some compiled version of the SQLite library can do. It can be built in many variations. The published source does not show what preprocessor inputs were used for a build.
If you dislike the compile_options pragma, there are tools for dumping exported symbols from linkable objects.
I don't dislike the compile_options pragma, nor using other means to detect this. I just hoped there would be some kind of configuration baked into the sqlite3.h header file.
What about generating and deploying a build config header (for example sqlite3config.h) in the make install target?