Detect R*Tree support at compile time
(1) By anonymous on 2021-03-11 09:07:18 [link] [source]
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.
(2) By Larry Brasfield (larrybr) on 2021-03-11 09:49:46 in reply to 1 [link] [source]
See https://sqlite.org/pragma.html#pragma_compile_options .
(3) By anonymous on 2021-03-11 11:02:34 in reply to 2 [source]
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 [link] [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.
(5) By Larry Brasfield (larrybr) on 2021-03-11 12:24:52 in reply to 3 [link] [source]
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.
(6) By anonymous on 2021-03-11 14:00:32 in reply to 5 [link] [source]
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?