From: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> |
---|---|
To: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Should contrib modules install .h files? |
Date: | 2018-07-31 23:33:11 |
Message-ID: | 87d0v3atbm.fsf@news-spur.riddles.org.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>>>>> "Peter" == Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
>> A review of contrib/ suggested that cube, hstore, isn, ltree and seg
>> were the only modules that had useful headers to install, so do
>> those.
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?
All of the below assumes PGXS.
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.
If you need to workaround for old versions in one makefile, as I do,
then you can do something along these lines (this goes before the
include $(PGXS) line):
# MAJORVERSION and includedir_server are not defined yet, but will be
# defined before PG_CPPFLAGS is expanded. So we use conditional
# expansions rather than 'ifeq' syntax.
# for pg11+, hstore.h will be installed here
HSTORE_INCDIR = $(includedir_server)/extension/hstore
# for pg 9.5/9.6/10, we have a local copy of hstore.h since it happens
# to be the same, barring non-semantic whitespace, between the three
# versions
HSTORE_INCDIR_OLD = old_inc
PG_CPPFLAGS += -I$(HSTORE_INCDIR$(if $(filter 9.% 10,$(MAJORVERSION)),_OLD))
If you need to distinguish more versions for whatever reason you can do
this:
HSTORE_INCDIR = $(includedir_server)/extension/hstore
HSTORE_INCDIR_10 = whatever
HSTORE_INCDIR_9.6 = whatever
HSTORE_INCDIR_9.5 = whatever
HSTORE_INCDIR_9.4 = whatever
HSTORE_INCDIR_9.3 = whatever
PG_CPPFLAGS += -I$(HSTORE_INCDIR$(if $(filter 9.% 10,$(MAJORVERSION)),_$(MAJORVERSION)))
--
Andrew (irc:RhodiumToad)
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2018-08-01 00:05:06 | Re: pg_upgrade from 9.4 to 10.4 |
Previous Message | Bruce Momjian | 2018-07-31 23:08:05 | Re: pg_upgrade from 9.4 to 10.4 |