summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2007-06-26 22:05:04 +0000
committerTom Lane2007-06-26 22:05:04 +0000
commit13232cc9c3abcd9e9e1552f9a5267c504bbe7288 (patch)
treedc5c2e45d8f29d9ed4118ac20eeb9d243a7410ff
parent6bba41bc2470551bef7fc959afd5d676d3429c9c (diff)
Fix PGXS conventions so that extensions can be built against Postgres
installations whose pg_config program does not appear first in the PATH. Per gripe from Eddie Stanley and subsequent discussions with Fabien Coelho and others.
-rw-r--r--contrib/adminpack/Makefile3
-rw-r--r--contrib/btree_gist/Makefile3
-rw-r--r--contrib/chkpass/Makefile3
-rw-r--r--contrib/cube/Makefile3
-rw-r--r--contrib/dblink/Makefile3
-rw-r--r--contrib/earthdistance/Makefile3
-rw-r--r--contrib/fuzzystrmatch/Makefile3
-rw-r--r--contrib/intagg/Makefile3
-rw-r--r--contrib/intarray/Makefile3
-rw-r--r--contrib/isn/Makefile3
-rw-r--r--contrib/lo/Makefile3
-rw-r--r--contrib/ltree/Makefile3
-rw-r--r--contrib/oid2name/Makefile3
-rw-r--r--contrib/pageinspect/Makefile3
-rw-r--r--contrib/pg_buffercache/Makefile3
-rw-r--r--contrib/pg_freespacemap/Makefile3
-rw-r--r--contrib/pg_standby/Makefile3
-rw-r--r--contrib/pg_standby/pg_standby.c1
-rw-r--r--contrib/pg_trgm/Makefile3
-rw-r--r--contrib/pgbench/Makefile3
-rw-r--r--contrib/pgcrypto/Makefile3
-rw-r--r--contrib/pgrowlocks/Makefile3
-rw-r--r--contrib/pgstattuple/Makefile3
-rw-r--r--contrib/seg/Makefile3
-rw-r--r--contrib/spi/Makefile3
-rw-r--r--contrib/sslinfo/Makefile3
-rw-r--r--contrib/tablefunc/Makefile3
-rw-r--r--contrib/tsearch2/Makefile3
-rw-r--r--contrib/tsearch2/ispell/Makefile3
-rw-r--r--contrib/tsearch2/snowball/Makefile3
-rw-r--r--contrib/tsearch2/wordparser/Makefile3
-rw-r--r--contrib/uuid-ossp/Makefile3
-rw-r--r--contrib/vacuumlo/Makefile3
-rw-r--r--contrib/xml2/Makefile3
-rw-r--r--doc/src/sgml/xfunc.sgml36
-rw-r--r--src/Makefile.global.in3
-rw-r--r--src/makefiles/pgxs.mk6
-rw-r--r--src/tutorial/Makefile3
38 files changed, 107 insertions, 41 deletions
diff --git a/contrib/adminpack/Makefile b/contrib/adminpack/Makefile
index 13a5de563c..b959b50517 100644
--- a/contrib/adminpack/Makefile
+++ b/contrib/adminpack/Makefile
@@ -8,7 +8,8 @@ DOCS = README.adminpack
OBJS = adminpack.o
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/adminpack
diff --git a/contrib/btree_gist/Makefile b/contrib/btree_gist/Makefile
index 7eac32eac1..5413353549 100644
--- a/contrib/btree_gist/Makefile
+++ b/contrib/btree_gist/Makefile
@@ -15,7 +15,8 @@ REGRESS = init int2 int4 int8 float4 float8 cash oid timestamp timestamptz t
date interval macaddr inet cidr text varchar char bytea bit varbit numeric
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/btree_gist
diff --git a/contrib/chkpass/Makefile b/contrib/chkpass/Makefile
index f6985bfc3b..9316d8196d 100644
--- a/contrib/chkpass/Makefile
+++ b/contrib/chkpass/Makefile
@@ -8,7 +8,8 @@ DATA = uninstall_chkpass.sql
DOCS = README.chkpass
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/chkpass
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 86ecf1f4d8..c5c0220a75 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -13,7 +13,8 @@ EXTRA_CLEAN = y.tab.c y.tab.h
SHLIB_LINK += $(filter -lm, $(LIBS))
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/cube
diff --git a/contrib/dblink/Makefile b/contrib/dblink/Makefile
index f74cec8594..8bfd4190ea 100644
--- a/contrib/dblink/Makefile
+++ b/contrib/dblink/Makefile
@@ -12,7 +12,8 @@ REGRESS = dblink
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/dblink
diff --git a/contrib/earthdistance/Makefile b/contrib/earthdistance/Makefile
index 12abc4174c..0fad891328 100644
--- a/contrib/earthdistance/Makefile
+++ b/contrib/earthdistance/Makefile
@@ -9,7 +9,8 @@ REGRESS = earthdistance
SHLIB_LINK += $(filter -lm, $(LIBS))
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/earthdistance
diff --git a/contrib/fuzzystrmatch/Makefile b/contrib/fuzzystrmatch/Makefile
index 50374e4226..bf8c3458b7 100644
--- a/contrib/fuzzystrmatch/Makefile
+++ b/contrib/fuzzystrmatch/Makefile
@@ -7,7 +7,8 @@ DATA = uninstall_fuzzystrmatch.sql
DOCS = README.fuzzystrmatch README.soundex
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/fuzzystrmatch
diff --git a/contrib/intagg/Makefile b/contrib/intagg/Makefile
index 6613af116e..147b6e0e8d 100644
--- a/contrib/intagg/Makefile
+++ b/contrib/intagg/Makefile
@@ -10,7 +10,8 @@ DATA = uninstall_int_aggregate.sql
DOCS = README.int_aggregate
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/intagg
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index ca63c4cacc..b9d372e7ab 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -8,7 +8,8 @@ DOCS = README.intarray
REGRESS = _int
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/intarray
diff --git a/contrib/isn/Makefile b/contrib/isn/Makefile
index 82201d7480..a111b656b7 100644
--- a/contrib/isn/Makefile
+++ b/contrib/isn/Makefile
@@ -6,7 +6,8 @@ DATA = uninstall_isn.sql
DOCS = README.isn
ifdef USE_PGXS
-PGXS = $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/isn
diff --git a/contrib/lo/Makefile b/contrib/lo/Makefile
index 5ad7de0a60..73cb9b86ef 100644
--- a/contrib/lo/Makefile
+++ b/contrib/lo/Makefile
@@ -6,7 +6,8 @@ DATA = uninstall_lo.sql
DOCS = README.lo
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/lo
diff --git a/contrib/ltree/Makefile b/contrib/ltree/Makefile
index 2dc37eb01f..2530d910ee 100644
--- a/contrib/ltree/Makefile
+++ b/contrib/ltree/Makefile
@@ -10,7 +10,8 @@ DOCS = README.ltree
REGRESS = ltree
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/ltree
diff --git a/contrib/oid2name/Makefile b/contrib/oid2name/Makefile
index 1b6665ff8b..0687c20c42 100644
--- a/contrib/oid2name/Makefile
+++ b/contrib/oid2name/Makefile
@@ -9,7 +9,8 @@ PG_LIBS = $(libpq_pgport)
DOCS = README.oid2name
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/oid2name
diff --git a/contrib/pageinspect/Makefile b/contrib/pageinspect/Makefile
index 3afa3a068d..890f353ca8 100644
--- a/contrib/pageinspect/Makefile
+++ b/contrib/pageinspect/Makefile
@@ -13,7 +13,8 @@ DATA_built = pageinspect.sql
DATA = uninstall_pageinspect.sql
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/pageinspect
diff --git a/contrib/pg_buffercache/Makefile b/contrib/pg_buffercache/Makefile
index c40b43a770..8c26de77db 100644
--- a/contrib/pg_buffercache/Makefile
+++ b/contrib/pg_buffercache/Makefile
@@ -8,7 +8,8 @@ DATA = uninstall_pg_buffercache.sql
DOCS = README.pg_buffercache
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/pg_buffercache
diff --git a/contrib/pg_freespacemap/Makefile b/contrib/pg_freespacemap/Makefile
index dcd6447b9e..8362b59af8 100644
--- a/contrib/pg_freespacemap/Makefile
+++ b/contrib/pg_freespacemap/Makefile
@@ -8,7 +8,8 @@ DATA = uninstall_pg_freespacemap.sql
DOCS = README.pg_freespacemap
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/pg_freespacemap
diff --git a/contrib/pg_standby/Makefile b/contrib/pg_standby/Makefile
index 2684611955..d7e4faf52f 100644
--- a/contrib/pg_standby/Makefile
+++ b/contrib/pg_standby/Makefile
@@ -9,7 +9,8 @@ PG_LIBS = $(libpq_pgport)
DOCS = README.pg_standby
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/pg_standby
diff --git a/contrib/pg_standby/pg_standby.c b/contrib/pg_standby/pg_standby.c
index de3ad5ed2e..bb885384c3 100644
--- a/contrib/pg_standby/pg_standby.c
+++ b/contrib/pg_standby/pg_standby.c
@@ -19,7 +19,6 @@
* Current maintainer: Simon Riggs
*/
#include "postgres_fe.h"
-#include "pg_config_manual.h"
#include <ctype.h>
#include <dirent.h>
diff --git a/contrib/pg_trgm/Makefile b/contrib/pg_trgm/Makefile
index df0b8dacff..9f490e04e2 100644
--- a/contrib/pg_trgm/Makefile
+++ b/contrib/pg_trgm/Makefile
@@ -10,7 +10,8 @@ REGRESS = pg_trgm
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/pg_trgm
diff --git a/contrib/pgbench/Makefile b/contrib/pgbench/Makefile
index 827a3c07c5..22fe556115 100644
--- a/contrib/pgbench/Makefile
+++ b/contrib/pgbench/Makefile
@@ -9,7 +9,8 @@ PG_LIBS = $(libpq_pgport)
DOCS = README.pgbench README.pgbench_jis
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/pgbench
diff --git a/contrib/pgcrypto/Makefile b/contrib/pgcrypto/Makefile
index b800d9450a..dd57b6d5f1 100644
--- a/contrib/pgcrypto/Makefile
+++ b/contrib/pgcrypto/Makefile
@@ -39,7 +39,8 @@ REGRESS = init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael \
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/pgcrypto
diff --git a/contrib/pgrowlocks/Makefile b/contrib/pgrowlocks/Makefile
index 84382e21f1..320adb20fe 100644
--- a/contrib/pgrowlocks/Makefile
+++ b/contrib/pgrowlocks/Makefile
@@ -13,7 +13,8 @@ DATA_built = pgrowlocks.sql
DATA = uninstall_pgrowlocks.sql
ifdef USE_PGXS
-PGXS = $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/pgrowlocks
diff --git a/contrib/pgstattuple/Makefile b/contrib/pgstattuple/Makefile
index 7e2e4b384f..326e13cbf0 100644
--- a/contrib/pgstattuple/Makefile
+++ b/contrib/pgstattuple/Makefile
@@ -13,7 +13,8 @@ DATA_built = pgstattuple.sql
DATA = uninstall_pgstattuple.sql
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/pgstattuple
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index 9059805e69..55ead9eaf0 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -10,7 +10,8 @@ REGRESS = seg
EXTRA_CLEAN = y.tab.c y.tab.h
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/seg
diff --git a/contrib/spi/Makefile b/contrib/spi/Makefile
index e9d78c4975..81a8963ac6 100644
--- a/contrib/spi/Makefile
+++ b/contrib/spi/Makefile
@@ -9,7 +9,8 @@ DOCS = README.spi $(addsuffix .example, $(MODULES))
PG_CPPFLAGS = -DREFINT_VERBOSE
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/spi
diff --git a/contrib/sslinfo/Makefile b/contrib/sslinfo/Makefile
index fc3621c8ae..658fba20f8 100644
--- a/contrib/sslinfo/Makefile
+++ b/contrib/sslinfo/Makefile
@@ -7,7 +7,8 @@ DATA = uninstall_sslinfo.sql
DOCS = README.sslinfo
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/sslinfo
diff --git a/contrib/tablefunc/Makefile b/contrib/tablefunc/Makefile
index 4b5b9312ee..c5b58cb1e2 100644
--- a/contrib/tablefunc/Makefile
+++ b/contrib/tablefunc/Makefile
@@ -9,7 +9,8 @@ REGRESS = tablefunc
SHLIB_LINK += $(filter -lm, $(LIBS))
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/tablefunc
diff --git a/contrib/tsearch2/Makefile b/contrib/tsearch2/Makefile
index 88abbfb7b8..6533b9ee16 100644
--- a/contrib/tsearch2/Makefile
+++ b/contrib/tsearch2/Makefile
@@ -25,7 +25,8 @@ SHLIB_LINK += $(filter -lm, $(LIBS))
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/tsearch2
diff --git a/contrib/tsearch2/ispell/Makefile b/contrib/tsearch2/ispell/Makefile
index 284ca11736..4dfe42b90d 100644
--- a/contrib/tsearch2/ispell/Makefile
+++ b/contrib/tsearch2/ispell/Makefile
@@ -7,7 +7,8 @@ EXTRA_CLEAN = SUBSYS.o $(SUBOBJS)
PG_CPPFLAGS = -I$(srcdir)/..
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/tsearch2/ispell
diff --git a/contrib/tsearch2/snowball/Makefile b/contrib/tsearch2/snowball/Makefile
index c23fcf624f..890eedf14d 100644
--- a/contrib/tsearch2/snowball/Makefile
+++ b/contrib/tsearch2/snowball/Makefile
@@ -7,7 +7,8 @@ EXTRA_CLEAN = SUBSYS.o $(SUBOBJS)
PG_CPPFLAGS = -I$(srcdir)/..
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/tsearch2/snowball
diff --git a/contrib/tsearch2/wordparser/Makefile b/contrib/tsearch2/wordparser/Makefile
index d166ebe865..60ee6cb4ca 100644
--- a/contrib/tsearch2/wordparser/Makefile
+++ b/contrib/tsearch2/wordparser/Makefile
@@ -7,7 +7,8 @@ EXTRA_CLEAN = SUBSYS.o $(SUBOBJS)
PG_CPPFLAGS = -I$(srcdir)/..
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/tsearch2/wordparser
diff --git a/contrib/uuid-ossp/Makefile b/contrib/uuid-ossp/Makefile
index 3f9b1749f7..fe20980ba8 100644
--- a/contrib/uuid-ossp/Makefile
+++ b/contrib/uuid-ossp/Makefile
@@ -9,7 +9,8 @@ DOCS = README.uuid-ossp
SHLIB_LINK += -lossp-uuid
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/uuid-ossp
diff --git a/contrib/vacuumlo/Makefile b/contrib/vacuumlo/Makefile
index cafb59b6bd..64833f6870 100644
--- a/contrib/vacuumlo/Makefile
+++ b/contrib/vacuumlo/Makefile
@@ -9,7 +9,8 @@ PG_LIBS = $(libpq_pgport)
DOCS = README.vacuumlo
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/vacuumlo
diff --git a/contrib/xml2/Makefile b/contrib/xml2/Makefile
index f7e4c48a54..8c43d3bddc 100644
--- a/contrib/xml2/Makefile
+++ b/contrib/xml2/Makefile
@@ -15,7 +15,8 @@ DOCS = README.xml2
override CFLAGS += $(shell xml2-config --cflags)
ifdef USE_PGXS
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/xml2
diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml
index 47f529a5c5..2c9ab245c5 100644
--- a/doc/src/sgml/xfunc.sgml
+++ b/doc/src/sgml/xfunc.sgml
@@ -2071,10 +2071,11 @@ MODULES = isbn_issn
DATA_built = isbn_issn.sql
DOCS = README.isbn_issn
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
</programlisting>
- The last two lines should always be the same. Earlier in the
+ The last three lines should always be the same. Earlier in the
file, you assign variables or add custom
<application>make</application> rules.
</para>
@@ -2215,6 +2216,18 @@ include $(PGXS)
</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><varname>PG_CONFIG</varname></term>
+ <listitem>
+ <para>
+ path to <application>pg_config</> program for the
+ <productname>PostgreSQL</productname> installation to build against
+ (typically just <literal>pg_config</> to use the first one in your
+ <varname>PATH</>)
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
</para>
@@ -2222,13 +2235,26 @@ include $(PGXS)
Put this makefile as <literal>Makefile</literal> in the directory
which holds your extension. Then you can do
<literal>make</literal> to compile, and later <literal>make
- install</literal> to install your module. The extension is
+ install</literal> to install your module. By default, the extension is
compiled and installed for the
<productname>PostgreSQL</productname> installation that
- corresponds to the first <command>pg_config</command> command
- found in your path.
+ corresponds to the first <command>pg_config</command> program
+ found in your path. You can use a different installation by
+ setting <varname>PG_CONFIG</varname> to point to its
+ <command>pg_config</command> program, either within the makefile
+ or on the <literal>make</literal> command line.
</para>
+ <caution>
+ <para>
+ Changing <varname>PG_CONFIG</varname> only works when building
+ against <productname>PostgreSQL</productname> 8.3 or later.
+ With older releases it does not work to set it to anything except
+ <literal>pg_config</>; you must alter your <varname>PATH</>
+ to select the installation to build against.
+ </para>
+ </caution>
+
<para>
The scripts listed in the <varname>REGRESS</> variable are used for
regression testing of your module, just like <literal>make
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 2fdf822853..1a14892096 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -118,7 +118,10 @@ localedir := @localedir@
else # PGXS case
+# Extension makefiles should set PG_CONFIG, but older ones might not
+ifndef PG_CONFIG
PG_CONFIG = pg_config
+endif
bindir := $(shell $(PG_CONFIG) --bindir)
datadir := $(shell $(PG_CONFIG) --sharedir)
diff --git a/src/makefiles/pgxs.mk b/src/makefiles/pgxs.mk
index c425882394..363793138f 100644
--- a/src/makefiles/pgxs.mk
+++ b/src/makefiles/pgxs.mk
@@ -11,7 +11,8 @@
# [variable assignments, see below]
# [custom rules, rarely necessary]
#
-# PGXS := $(shell pg_config --pgxs)
+# PG_CONFIG = pg_config
+# PGXS := $(shell $(PG_CONFIG) --pgxs)
# include $(PGXS)
#
# The following variables can be set:
@@ -38,6 +39,9 @@
# PG_CPPFLAGS -- will be added to CPPFLAGS
# PG_LIBS -- will be added to PROGRAM link line
# SHLIB_LINK -- will be added to MODULE_big link line
+# PG_CONFIG -- path to pg_config program for the PostgreSQL installation
+# to build against (typically just "pg_config" to use the first one in
+# your PATH)
#
# Better look at some of the existing uses for examples...
diff --git a/src/tutorial/Makefile b/src/tutorial/Makefile
index 441f196ec3..12a3b1af59 100644
--- a/src/tutorial/Makefile
+++ b/src/tutorial/Makefile
@@ -24,7 +24,8 @@ top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/src/makefiles/pgxs.mk
else
-PGXS := $(shell pg_config --pgxs)
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
endif