diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index f9bf7b831fda1715f3d581d9ed2e7acaed9b6a91..fd4af312523dd3761005d235d91d4389081af17b 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -8,7 +8,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/doc/src/sgml/Makefile,v 1.17 2000/07/21 00:44:11 petere Exp $
+#    $Header: /cvsroot/pgsql/doc/src/sgml/Makefile,v 1.18 2000/08/26 13:08:14 petere Exp $
 #
 #----------------------------------------------------------------------------
 
@@ -78,6 +78,7 @@ APPLICATIONS= createdb.sgml createlang.sgml createuser.sgml \
 	pg_upgrade.sgml \
 	pgaccess-ref.sgml \
 	pgadmin-ref.sgml \
+	pg-config-ref.sgml \
 	pgctl-ref.sgml \
 	pgtclsh.sgml \
 	pgtksh.sgml \
diff --git a/doc/src/sgml/ref/allfiles.sgml b/doc/src/sgml/ref/allfiles.sgml
index 1acdae9b24fa0628d585689090729c28651eaab6..1bb3a0769d136f0cb86ce28b53a8ced807073bdf 100644
--- a/doc/src/sgml/ref/allfiles.sgml
+++ b/doc/src/sgml/ref/allfiles.sgml
@@ -1,5 +1,5 @@
 <!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.20 2000/07/14 15:27:14 thomas Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.21 2000/08/26 13:08:15 petere Exp $
 Postgres documentation
 Complete list of usable sgml source files in this directory.
 -->
@@ -120,6 +120,7 @@ Complete list of usable sgml source files in this directory.
 <!entity ipcclean           system "ipcclean.sgml">
 <!entity pgAccess           system "pgaccess-ref.sgml">
 <!entity pgAdmin            system "pgadmin-ref.sgml">
+<!entity pgConfig           system "pg-config-ref.sgml">
 <!entity pgCtl              system "pgctl-ref.sgml">
 <!entity pgDump             system "pg_dump.sgml">
 <!entity pgDumpall          system "pg_dumpall.sgml">
diff --git a/doc/src/sgml/ref/commands.sgml b/doc/src/sgml/ref/commands.sgml
index 28a3e12ab7bef955ea7d9687d5d82d45bf36b1a5..1233c002f454c18c0a07f9f7c6169c6817c6b15b 100644
--- a/doc/src/sgml/ref/commands.sgml
+++ b/doc/src/sgml/ref/commands.sgml
@@ -1,5 +1,5 @@
 <!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/commands.sgml,v 1.27 2000/07/14 15:27:14 thomas Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/commands.sgml,v 1.28 2000/08/26 13:08:15 petere Exp $
 Postgres documentation
 -->
 
@@ -124,6 +124,7 @@ functions supported by <productname>Postgres</productname>.
    &ecpgRef;
    &pgAccess;
    &pgAdmin;
+   &pgConfig;
    &pgCtl;
    &pgDump;
    &pgDumpall;
diff --git a/doc/src/sgml/ref/pg-config-ref.sgml b/doc/src/sgml/ref/pg-config-ref.sgml
new file mode 100644
index 0000000000000000000000000000000000000000..72ce46f514e5669a0a8e0242907290fb1a1920f0
--- /dev/null
+++ b/doc/src/sgml/ref/pg-config-ref.sgml
@@ -0,0 +1,90 @@
+<!-- $Header -->
+
+<refentry id="app-pg-config">
+ <refmeta>
+  <refentrytitle id="app-pg-config-title">pg-config</>
+  <refmiscinfo>Application</>
+ </refmeta>
+
+ <refnamediv>
+  <refname>pg-config</>
+  <refpurpose>Provides information about the installed version of <productname>PostgreSQL</></>
+ </refnamediv>
+
+ <refsynopsisdiv>
+<synopsis>
+pg-config --bindir | --includedir | --libdir | --configure | --version
+</synopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+  <title>Description</>
+  <para>
+   The <application>pg-config</> stores and provides configuration parameters
+   of the currently installed version of <productname>PostgreSQL</>. It is
+   intended, for example, to be used by software packages that want to interface
+   to <productname>PostgreSQL</> in order to find the respective header files
+   and libraries.
+  </para>
+
+  <para>
+   To use <application>pg-config</>, supply one or more of the following options:
+   <variablelist>
+    <varlistentry>
+     <term>--bindir</>
+     <listitem>
+      <para>
+       Print the location of user executables. Use this, for example, to find
+       the <application>psql</> program. This is normally also the location
+       where the <filename>pg-config</> program resides.       
+      </para>
+     </listitem>
+    </varlistentry>
+
+    <varlistentry>
+     <term>--includedir</>
+     <listitem>
+      <para>
+       Print the location of C and C++ header files.
+      </para>
+     </listitem>
+    </varlistentry>
+
+    <varlistentry>
+     <term>--libdir</>
+     <listitem>
+      <para>
+       Print the location of object code libraries.
+      </para>
+     </listitem>
+    </varlistentry>
+
+    <varlistentry>
+     <term>--configure</>
+     <listitem>
+      <para>
+       Print the options that were given to the <filename>configure</>
+       script when <productname>PostgreSQL</> was configured for building.
+       This can be used to reproduce the identical configuration, or
+       to find out with what options a binary package was built. (Note
+       however that binary packages often contain vendor-specific custom
+       patches.)
+      </para>
+     </listitem>
+    </varlistentry>
+
+    <varlistentry>
+     <term>--version</>
+     <listitem>
+      <para>
+       Print the version of <productname>PostgreSQL</> and exit.
+      </para>
+     </listitem>
+    </varlistentry>
+   </variablelist>
+
+   If more than one option (except for <option>--version</>) is given, the
+   information is printed in that order, one item per line.
+  </para>
+ </refsect1>
+</refentry>
diff --git a/src/bin/Makefile b/src/bin/Makefile
index 0029f6f99ec9bf8910448064f08e2c3110d92747..fecfc7d157c8afa2be218f228a6fd88d89ab3418 100644
--- a/src/bin/Makefile
+++ b/src/bin/Makefile
@@ -4,7 +4,7 @@
 #
 # Copyright (c) 1994, Regents of the University of California
 #
-# $Header: /cvsroot/pgsql/src/bin/Makefile,v 1.29 2000/07/19 16:29:53 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/Makefile,v 1.30 2000/08/26 13:08:15 petere Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -13,7 +13,7 @@ top_builddir = ../..
 include ../Makefile.global
 
 DIRS := initdb initlocation ipcclean pg_ctl pg_dump pg_id \
-	pg_passwd psql scripts
+	pg_passwd psql scripts pg-config
 
 ifdef MULTIBYTE
 DIRS += pg_encoding
diff --git a/src/bin/pg-config/Makefile b/src/bin/pg-config/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..3c2b5a0866d0cdbe03c389db7ecb113739ecd594
--- /dev/null
+++ b/src/bin/pg-config/Makefile
@@ -0,0 +1,31 @@
+# $Header: /cvsroot/pgsql/src/bin/pg-config/Attic/Makefile,v 1.1 2000/08/26 13:08:16 petere Exp $
+
+subdir = src/bin/pg-config
+top_builddir = ../../..
+include $(top_builddir)/src/Makefile.global
+
+all: pg-config
+
+pg-config: pg-config.sh $(top_builddir)/config.status $(top_builddir)/src/Makefile.global Makefile
+	rm -f $@ $@.tmp
+	configure=`sed -n '7s,^# [^ ]*configure *,,p' $(top_builddir)/config.status` && \
+	sed -e 's,@bindir@,$(bindir),g' \
+	    -e 's,@includedir@,$(includedir),g' \
+	    -e 's,@libdir@,$(libdir),g' \
+	    -e "s,@configure@,$$configure,g" \
+	    -e 's,@version@,$(VERSION),g' \
+	  $< >$@.tmp
+	chmod a+x $@.tmp
+	mv $@.tmp $@
+
+install: all installdirs
+	$(INSTALL_SCRIPT) pg-config $(bindir)/pg-config
+
+installdirs:
+	$(mkinstalldirs) $(bindir)
+
+uninstall:
+	rm -f $(bindir)/pg-config
+
+clean distclean maintainer-clean:
+	rm -f pg-config
diff --git a/src/bin/pg-config/pg-config.sh b/src/bin/pg-config/pg-config.sh
new file mode 100644
index 0000000000000000000000000000000000000000..5a6a88ae3c1f8c881497a46fdc5b027e09ed17fa
--- /dev/null
+++ b/src/bin/pg-config/pg-config.sh
@@ -0,0 +1,70 @@
+#! /bin/sh
+
+# This shell script saves various pieces of information about the
+# installed version of PostgreSQL.  Packages that interface to
+# PostgreSQL can use it to configure their build.
+#
+# Author:  Peter Eisentraut <peter_e@gmx.net> 
+# Public domain
+
+# $Header: /cvsroot/pgsql/src/bin/pg-config/Attic/pg-config.sh,v 1.1 2000/08/26 13:08:16 petere Exp $
+
+me=`basename $0`
+
+# stored configuration values
+val_bindir='@bindir@'
+val_includedir='@includedir@'
+val_libdir='@libdir@'
+val_configure='@configure@'
+val_version='@version@'
+
+help="\
+$me provides information about the installed version of PostgreSQL.
+
+Usage: $me --bindir | --includedir | --libdir | --configure | --version
+
+Operation modes:
+  --bindir      show location of user executables
+  --includedir  show location of C header files
+  --libdir      show location of object code libraries
+  --configure   show options given to \`configure' script when
+                PostgreSQL was built
+  --version     show PostgreSQL version and exit
+
+Report bugs to <pgsql-bugs@postgresql.org>."
+
+advice="\
+Try \`$me --help' for more information."
+
+if test $# -eq 0 ; then
+    echo "$me: argument required"
+    echo "$advice"
+    exit 1
+fi
+
+show=
+
+for opt
+do
+    case $opt in
+        --bindir)       show="$show \$val_bindir";;
+        --includedir)   show="$show \$val_includedir";;
+        --libdir)       show="$show \$val_libdir";;
+        --configure)    show="$show \$val_configure";;
+
+	--version)      echo "PostgreSQL $val_version"
+                        exit 0;;
+	--help|-\?)     echo "$help"
+                        exit 0;;
+        *)              echo "$me: invalid argument: $opt"
+                        echo "$advice"
+                        exit 1;;
+    esac
+done
+
+for thing in $show
+do
+    eval "echo $thing"
+done
+
+# end of pg-config