Re: Should contrib modules install .h files?

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, pgsql-hackers@postgresql.org
Date: 2018-08-01T02:44:32Z
Lists: pgsql-hackers
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> "Peter" == Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
>  Peter> I'm missing some guidance what an extension using those headers
>  Peter> is supposed to do. How does it get the right -I options?

> If your extension is relying on pg11+, or you have checked the pg
> version when constructing the makefile, you can just do:
> PG_CPPFLAGS += -I$(includedir_server)/extension/hstore
> and #include "hstore.h" will work.

I remain of the opinion that it'd be smarter to do

PG_CPPFLAGS += -I$(includedir_server)/extension

then

#include "hstore/hstore.h"

This way requires fewer -I options and is far more robust against header
name conflicts.

			regards, tom lane


Commits

  1. Fix out-of-tree build for transform modules.

  2. Provide for contrib and pgxs modules to install include files.