Re: Should contrib modules install .h files?
От | Andrew Gierth |
---|---|
Тема | Re: Should contrib modules install .h files? |
Дата | |
Msg-id | 87d0v3atbm.fsf@news-spur.riddles.org.uk обсуждение исходный текст |
Ответ на | Re: Should contrib modules install .h files? (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>) |
Ответы |
Re: Should contrib modules install .h files?
|
Список | pgsql-hackers |
>>>>> "Peter" == Peter Eisentraut <peter.eisentraut@2ndquadrant.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)
В списке pgsql-hackers по дате отправления: