SQLite Forum

How to use SQLITE_CUSTOM_INCLUDE in configure
Login

How to use SQLITE_CUSTOM_INCLUDE in configure

(1) By anonymous on 2021-12-03 23:59:56 [link] [source]

As of version 3.37 a SQLITE_CUSTOM_INCLUDE macro is supported. How do you tell configure to add this to the generated Makefile?

(2) By Stephan Beal (stephan) on 2021-12-04 00:15:04 in reply to 1 [link] [source]

How do you tell configure to add this to the generated Makefile?

The custom include is not intended to be added to the sqlite-generated makefile. It's intended to be used to customize a local build of the sqlite3.c amalgamation, like so:

$ echo '#warning "foo"' > foo.h
$ gcc -c sqlite3.c -DSQLITE_CUSTOM_INCLUDE=foo.h
In file included from sqlite3.c:298:
foo.h:1:2: warning: #warning "foo" [-Wcpp]
    1 | #warning "foo"
      |  ^~~~~~~

(3) By Larry Brasfield (larrybr) on 2021-12-04 00:26:45 in reply to 1 [source]

That preprocessor symbol and its treatment is not intended to be used as a build option by itself.

Its purpose is to permit a file of the builder's choice to be #include'd by defining a preprocessor symbol value at compile or make time. And the way you do that is to add, to the make invocation, something resembling:

  "OPTS=-DSQLITE_CUSTOM_INCLUDE=my_custom_defines.h"

Persusing the Makefile, you can see that this is a supported build alteration:

  # Add in any optional parameters specified on the make commane line
  # ie.  make "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1".
  TCC += $(OPTS)

If you like to invoke the compiler yourself, leave off the "OPTS=" part and put the remainder along with other compiler options in the invocation tail.

If you really like just typing (something as simple as) "make", you could write an alias to add the "OPTS=..." part.

(4) By anonymous on 2021-12-04 01:48:06 in reply to 3 [link] [source]

And that was exactly what I was looking for!

It works, thanks.