Fix problems with PGXS builds against an installation tree that was
relocated after installation. We can't trust the installation paths inserted into Makefile.global by configure, so instead we must get the paths from pg_config. This requires extending pg_config to support all the separately-configurable path names, but that was on TODO anyway.
This commit is contained in:
parent
2d8225eecc
commit
4fc935a5d4
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/pg_config-ref.sgml,v 1.21 2005/08/09 22:47:03 tgl Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/pg_config-ref.sgml,v 1.22 2005/09/27 17:39:32 tgl Exp $ -->
|
||||
|
||||
<refentry id="app-pgconfig">
|
||||
<refmeta>
|
||||
@ -53,6 +53,17 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--docdir</option></>
|
||||
<listitem>
|
||||
<para>
|
||||
Print the location of documentation files. (This will be an empty
|
||||
string if <literal>--without-docdir</> was specified when
|
||||
<productname>PostgreSQL</> was built.)
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--includedir</option></>
|
||||
<listitem>
|
||||
@ -62,12 +73,20 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--pkgincludedir</option></>
|
||||
<listitem>
|
||||
<para>
|
||||
Print the location of other C header files.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--includedir-server</option></>
|
||||
<listitem>
|
||||
<para>
|
||||
Print the location of C header files for server
|
||||
programming.
|
||||
Print the location of C header files for server programming.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -93,6 +112,44 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--localedir</option></>
|
||||
<listitem>
|
||||
<para>
|
||||
Print the location of locale support files. (This will be an empty
|
||||
string if locale support was not configured when
|
||||
<productname>PostgreSQL</> was built.)
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--mandir</option></>
|
||||
<listitem>
|
||||
<para>
|
||||
Print the location of manual pages.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--sharedir</option></>
|
||||
<listitem>
|
||||
<para>
|
||||
Print the location of architecture-independent support files.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--sysconfdir</option></>
|
||||
<listitem>
|
||||
<para>
|
||||
Print the location of system-wide configuration files.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--pgxs</option></>
|
||||
<listitem>
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*-makefile-*-
|
||||
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.219 2005/08/02 19:02:31 tgl Exp $
|
||||
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.220 2005/09/27 17:39:32 tgl Exp $
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# All PostgreSQL makefiles include this file and use the variables it sets,
|
||||
@ -55,19 +55,20 @@ configure_args = @configure_args@
|
||||
# These are set by the equivalent --xxxdir configure options. We
|
||||
# append "postgresql" to some of them, if the string does not already
|
||||
# contain "pgsql" or "postgres", in order to avoid directory clutter.
|
||||
#
|
||||
# In a PGXS build, we cannot use the values inserted into Makefile.global
|
||||
# by configure, since the installation tree may have been relocated.
|
||||
# Instead get the path values from pg_config.
|
||||
|
||||
ifndef PGXS
|
||||
|
||||
# Note that prefix and exec_prefix aren't defined in a PGXS build;
|
||||
# makefiles may only use the derived variables such as bindir.
|
||||
|
||||
prefix := @prefix@
|
||||
exec_prefix := @exec_prefix@
|
||||
|
||||
bindir := @bindir@
|
||||
sbindir := @sbindir@
|
||||
|
||||
libexecdir := @libexecdir@
|
||||
ifeq "$(findstring pgsql, $(libexecdir))" ""
|
||||
ifeq "$(findstring postgres, $(libexecdir))" ""
|
||||
override libexecdir := $(libexecdir)/postgresql
|
||||
endif
|
||||
endif
|
||||
|
||||
datadir := @datadir@
|
||||
ifeq "$(findstring pgsql, $(datadir))" ""
|
||||
@ -84,6 +85,7 @@ endif
|
||||
endif
|
||||
|
||||
libdir := @libdir@
|
||||
|
||||
pkglibdir = $(libdir)
|
||||
ifeq "$(findstring pgsql, $(pkglibdir))" ""
|
||||
ifeq "$(findstring postgres, $(pkglibdir))" ""
|
||||
@ -92,17 +94,15 @@ endif
|
||||
endif
|
||||
|
||||
includedir := @includedir@
|
||||
|
||||
pkgincludedir = $(includedir)
|
||||
ifeq "$(findstring pgsql, $(pkgincludedir))" ""
|
||||
ifeq "$(findstring postgres, $(pkgincludedir))" ""
|
||||
override pkgincludedir := $(pkgincludedir)/postgresql
|
||||
endif
|
||||
endif
|
||||
includedir_server = $(pkgincludedir)/server
|
||||
includedir_internal = $(pkgincludedir)/internal
|
||||
|
||||
mandir := @mandir@
|
||||
sqlmansect_dummy = l
|
||||
|
||||
docdir := @docdir@
|
||||
# docdir can be an empty string to signify --without-docdir
|
||||
@ -116,8 +116,29 @@ endif
|
||||
|
||||
localedir := @localedir@
|
||||
|
||||
else # PGXS case
|
||||
|
||||
bindir := $(shell pg_config --bindir)
|
||||
datadir := $(shell pg_config --sharedir)
|
||||
sysconfdir := $(shell pg_config --sysconfdir)
|
||||
libdir := $(shell pg_config --libdir)
|
||||
pkglibdir := $(shell pg_config --pkglibdir)
|
||||
includedir := $(shell pg_config --includedir)
|
||||
pkgincludedir := $(shell pg_config --pkgincludedir)
|
||||
mandir := $(shell pg_config --mandir)
|
||||
docdir := $(shell pg_config --docdir)
|
||||
localedir := $(shell pg_config --localedir)
|
||||
|
||||
endif # PGXS
|
||||
|
||||
# These derived path variables aren't separately configurable.
|
||||
|
||||
includedir_server = $(pkgincludedir)/server
|
||||
includedir_internal = $(pkgincludedir)/internal
|
||||
pgxsdir = $(pkglibdir)/pgxs
|
||||
|
||||
sqlmansect_dummy = l
|
||||
|
||||
|
||||
##########################################################################
|
||||
#
|
||||
|
@ -17,7 +17,7 @@
|
||||
*
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.12 2005/08/09 22:47:03 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.13 2005/09/27 17:39:33 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -52,6 +52,17 @@ show_bindir(bool all)
|
||||
printf("%s\n", path);
|
||||
}
|
||||
|
||||
static void
|
||||
show_docdir(bool all)
|
||||
{
|
||||
char path[MAXPGPATH];
|
||||
|
||||
if (all)
|
||||
printf("DOCDIR = ");
|
||||
get_doc_path(mypath, path);
|
||||
printf("%s\n", path);
|
||||
}
|
||||
|
||||
static void
|
||||
show_includedir(bool all)
|
||||
{
|
||||
@ -63,6 +74,17 @@ show_includedir(bool all)
|
||||
printf("%s\n", path);
|
||||
}
|
||||
|
||||
static void
|
||||
show_pkgincludedir(bool all)
|
||||
{
|
||||
char path[MAXPGPATH];
|
||||
|
||||
if (all)
|
||||
printf("PKGINCLUDEDIR = ");
|
||||
get_pkginclude_path(mypath, path);
|
||||
printf("%s\n", path);
|
||||
}
|
||||
|
||||
static void
|
||||
show_includedir_server(bool all)
|
||||
{
|
||||
@ -96,6 +118,50 @@ show_pkglibdir(bool all)
|
||||
printf("%s\n", path);
|
||||
}
|
||||
|
||||
static void
|
||||
show_localedir(bool all)
|
||||
{
|
||||
char path[MAXPGPATH];
|
||||
|
||||
if (all)
|
||||
printf("LOCALEDIR = ");
|
||||
get_locale_path(mypath, path);
|
||||
printf("%s\n", path);
|
||||
}
|
||||
|
||||
static void
|
||||
show_mandir(bool all)
|
||||
{
|
||||
char path[MAXPGPATH];
|
||||
|
||||
if (all)
|
||||
printf("MANDIR = ");
|
||||
get_man_path(mypath, path);
|
||||
printf("%s\n", path);
|
||||
}
|
||||
|
||||
static void
|
||||
show_sharedir(bool all)
|
||||
{
|
||||
char path[MAXPGPATH];
|
||||
|
||||
if (all)
|
||||
printf("SHAREDIR = ");
|
||||
get_share_path(mypath, path);
|
||||
printf("%s\n", path);
|
||||
}
|
||||
|
||||
static void
|
||||
show_sysconfdir(bool all)
|
||||
{
|
||||
char path[MAXPGPATH];
|
||||
|
||||
if (all)
|
||||
printf("SYSCONFDIR = ");
|
||||
get_etc_path(mypath, path);
|
||||
printf("%s\n", path);
|
||||
}
|
||||
|
||||
static void
|
||||
show_pgxs(bool all)
|
||||
{
|
||||
@ -234,10 +300,16 @@ typedef struct
|
||||
|
||||
static const InfoItem info_items[] = {
|
||||
{ "--bindir", show_bindir },
|
||||
{ "--docdir", show_docdir },
|
||||
{ "--includedir", show_includedir },
|
||||
{ "--pkgincludedir", show_pkgincludedir },
|
||||
{ "--includedir-server", show_includedir_server },
|
||||
{ "--libdir", show_libdir },
|
||||
{ "--pkglibdir", show_pkglibdir },
|
||||
{ "--localedir", show_localedir },
|
||||
{ "--mandir", show_mandir },
|
||||
{ "--sharedir", show_sharedir },
|
||||
{ "--sysconfdir", show_sysconfdir },
|
||||
{ "--pgxs", show_pgxs },
|
||||
{ "--configure", show_configure },
|
||||
{ "--cc", show_cc },
|
||||
@ -260,11 +332,17 @@ help(void)
|
||||
printf(_(" %s [ OPTION ... ]\n\n"), progname);
|
||||
printf(_("Options:\n"));
|
||||
printf(_(" --bindir show location of user executables\n"));
|
||||
printf(_(" --docdir show location of documentation files\n"));
|
||||
printf(_(" --includedir show location of C header files of the client\n"
|
||||
" interfaces\n"));
|
||||
printf(_(" --pkgincludedir show location of other C header files\n"));
|
||||
printf(_(" --includedir-server show location of C header files for the server\n"));
|
||||
printf(_(" --libdir show location of object code libraries\n"));
|
||||
printf(_(" --pkglibdir show location of dynamically loadable modules\n"));
|
||||
printf(_(" --localedir show location of locale support files\n"));
|
||||
printf(_(" --mandir show location of manual pages\n"));
|
||||
printf(_(" --sharedir show location of architecture-independent support files\n"));
|
||||
printf(_(" --sysconfdir show location of system-wide configuration files\n"));
|
||||
printf(_(" --pgxs show location of extension makefile\n"));
|
||||
printf(_(" --configure show options given to \"configure\" script when\n"
|
||||
" PostgreSQL was built\n"));
|
||||
|
@ -39,6 +39,8 @@ CLEAN :
|
||||
echo #define LIBDIR "" >>$@
|
||||
echo #define PKGLIBDIR "" >>$@
|
||||
echo #define LOCALEDIR "" >>$@
|
||||
echo #define DOCDIR "" >>$@
|
||||
echo #define MANDIR "" >>$@
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
@ -159,6 +159,8 @@ LINK32_OBJS = $(LINK32_OBJS) "..\..\interfaces\libpq\Release\blibpqdll.lib"
|
||||
echo \#define LIBDIR "" >>$@
|
||||
echo \#define PKGLIBDIR "" >>$@
|
||||
echo \#define LOCALEDIR "" >>$@
|
||||
echo \#define DOCDIR "" >>$@
|
||||
echo \#define MANDIR "" >>$@
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
@ -108,6 +108,8 @@ LINK32_OBJS = $(LINK32_OBJS) "..\..\interfaces\libpq\Release\libpqdll.lib"
|
||||
echo #define LIBDIR "" >>$@
|
||||
echo #define PKGLIBDIR "" >>$@
|
||||
echo #define LOCALEDIR "" >>$@
|
||||
echo #define DOCDIR "" >>$@
|
||||
echo #define MANDIR "" >>$@
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/port.h,v 1.82 2005/08/29 19:39:39 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/port.h,v 1.83 2005/09/27 17:39:34 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -43,6 +43,8 @@ extern void get_includeserver_path(const char *my_exec_path, char *ret_path);
|
||||
extern void get_lib_path(const char *my_exec_path, char *ret_path);
|
||||
extern void get_pkglib_path(const char *my_exec_path, char *ret_path);
|
||||
extern void get_locale_path(const char *my_exec_path, char *ret_path);
|
||||
extern void get_doc_path(const char *my_exec_path, char *ret_path);
|
||||
extern void get_man_path(const char *my_exec_path, char *ret_path);
|
||||
extern void set_pglocale_pgservice(const char *argv0, const char *app);
|
||||
extern bool get_home_path(char *ret_path);
|
||||
extern void get_parent_directory(char *path);
|
||||
|
@ -15,7 +15,7 @@
|
||||
# for use only by the backend binaries
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $PostgreSQL: pgsql/src/port/Makefile,v 1.28 2005/08/12 19:45:14 momjian Exp $
|
||||
# $PostgreSQL: pgsql/src/port/Makefile,v 1.29 2005/09/27 17:39:35 tgl Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -81,6 +81,8 @@ pg_config_paths.h: $(top_builddir)/src/Makefile.global
|
||||
echo "#define LIBDIR \"$(libdir)\"" >>$@
|
||||
echo "#define PKGLIBDIR \"$(pkglibdir)\"" >>$@
|
||||
echo "#define LOCALEDIR \"$(localedir)\"" >>$@
|
||||
echo "#define DOCDIR \"$(docdir)\"" >>$@
|
||||
echo "#define MANDIR \"$(mandir)\"" >>$@
|
||||
|
||||
clean distclean maintainer-clean:
|
||||
rm -f libpgport.a libpgport_srv.a $(LIBOBJS) $(LIBOBJS_SRV) pg_config_paths.h
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/port/path.c,v 1.58 2005/08/29 19:39:39 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/port/path.c,v 1.59 2005/09/27 17:39:35 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -538,6 +538,24 @@ get_locale_path(const char *my_exec_path, char *ret_path)
|
||||
make_relative_path(ret_path, LOCALEDIR, PGBINDIR, my_exec_path);
|
||||
}
|
||||
|
||||
/*
|
||||
* get_doc_path
|
||||
*/
|
||||
void
|
||||
get_doc_path(const char *my_exec_path, char *ret_path)
|
||||
{
|
||||
make_relative_path(ret_path, DOCDIR, PGBINDIR, my_exec_path);
|
||||
}
|
||||
|
||||
/*
|
||||
* get_man_path
|
||||
*/
|
||||
void
|
||||
get_man_path(const char *my_exec_path, char *ret_path)
|
||||
{
|
||||
make_relative_path(ret_path, MANDIR, PGBINDIR, my_exec_path);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_home_path
|
||||
|
Loading…
x
Reference in New Issue
Block a user