Put path configuration information into a .h file instead of cluttering
several different module Makefiles with it. Also, do any adjustment of installation paths during configure, rather than every time Makefile.global is read.
This commit is contained in:
parent
748a15a8ea
commit
13f96c4b6b
55
configure
vendored
55
configure
vendored
@ -17939,6 +17939,59 @@ CFLAGS="$_CFLAGS"
|
||||
LIBS="$_LIBS"
|
||||
fi
|
||||
|
||||
# Adjust installation directories.
|
||||
#
|
||||
# These are initially 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.
|
||||
|
||||
if echo "$libexecdir" | egrep 'pgsql|postgres' >/dev/null 2>&1
|
||||
then
|
||||
:
|
||||
else
|
||||
libexecdir="$libexecdir/postgresql"
|
||||
fi
|
||||
|
||||
if echo "$datadir" | egrep 'pgsql|postgres' >/dev/null 2>&1
|
||||
then
|
||||
:
|
||||
else
|
||||
datadir="$datadir/postgresql"
|
||||
fi
|
||||
|
||||
if echo "$sysconfdir" | egrep 'pgsql|postgres' >/dev/null 2>&1
|
||||
then
|
||||
:
|
||||
else
|
||||
sysconfdir="$sysconfdir/postgresql"
|
||||
fi
|
||||
|
||||
pkglibdir="$libdir"
|
||||
if echo "$pkglibdir" | egrep 'pgsql|postgres' >/dev/null 2>&1
|
||||
then
|
||||
:
|
||||
else
|
||||
pkglibdir="$pkglibdir/postgresql"
|
||||
fi
|
||||
|
||||
|
||||
pkgincludedir="$includedir"
|
||||
if echo "$pkgincludedir" | egrep 'pgsql|postgres' >/dev/null 2>&1
|
||||
then
|
||||
:
|
||||
else
|
||||
pkgincludedir="$pkgincludedir/postgresql"
|
||||
fi
|
||||
|
||||
|
||||
if echo "$docdir" | egrep 'pgsql|postgres' >/dev/null 2>&1
|
||||
then
|
||||
:
|
||||
else
|
||||
docdir="$docdir/postgresql"
|
||||
fi
|
||||
|
||||
|
||||
# prepare build tree if outside source tree
|
||||
# Note 1: test -ef might not exist, but it's more reliable than `pwd`.
|
||||
# Note 2: /bin/pwd might be better than shell's built-in at getting
|
||||
@ -18639,6 +18692,8 @@ s,@have_docbook@,$have_docbook,;t t
|
||||
s,@DOCBOOKSTYLE@,$DOCBOOKSTYLE,;t t
|
||||
s,@COLLATEINDEX@,$COLLATEINDEX,;t t
|
||||
s,@SGMLSPL@,$SGMLSPL,;t t
|
||||
s,@pkglibdir@,$pkglibdir,;t t
|
||||
s,@pkgincludedir@,$pkgincludedir,;t t
|
||||
s,@vpath_build@,$vpath_build,;t t
|
||||
CEOF
|
||||
|
||||
|
55
configure.in
55
configure.in
@ -1,5 +1,5 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl $PostgreSQL: pgsql/configure.in,v 1.356 2004/05/21 05:07:54 tgl Exp $
|
||||
dnl $PostgreSQL: pgsql/configure.in,v 1.357 2004/05/21 20:56:47 tgl Exp $
|
||||
dnl
|
||||
dnl Developers, please strive to achieve this order:
|
||||
dnl
|
||||
@ -1202,6 +1202,59 @@ CFLAGS="$_CFLAGS"
|
||||
LIBS="$_LIBS"
|
||||
fi
|
||||
|
||||
# Adjust installation directories.
|
||||
#
|
||||
# These are initially 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.
|
||||
|
||||
if echo "$libexecdir" | egrep 'pgsql|postgres' >/dev/null 2>&1
|
||||
then
|
||||
:
|
||||
else
|
||||
libexecdir="$libexecdir/postgresql"
|
||||
fi
|
||||
|
||||
if echo "$datadir" | egrep 'pgsql|postgres' >/dev/null 2>&1
|
||||
then
|
||||
:
|
||||
else
|
||||
datadir="$datadir/postgresql"
|
||||
fi
|
||||
|
||||
if echo "$sysconfdir" | egrep 'pgsql|postgres' >/dev/null 2>&1
|
||||
then
|
||||
:
|
||||
else
|
||||
sysconfdir="$sysconfdir/postgresql"
|
||||
fi
|
||||
|
||||
pkglibdir="$libdir"
|
||||
if echo "$pkglibdir" | egrep 'pgsql|postgres' >/dev/null 2>&1
|
||||
then
|
||||
:
|
||||
else
|
||||
pkglibdir="$pkglibdir/postgresql"
|
||||
fi
|
||||
AC_SUBST(pkglibdir)
|
||||
|
||||
pkgincludedir="$includedir"
|
||||
if echo "$pkgincludedir" | egrep 'pgsql|postgres' >/dev/null 2>&1
|
||||
then
|
||||
:
|
||||
else
|
||||
pkgincludedir="$pkgincludedir/postgresql"
|
||||
fi
|
||||
AC_SUBST(pkgincludedir)
|
||||
|
||||
if echo "$docdir" | egrep 'pgsql|postgres' >/dev/null 2>&1
|
||||
then
|
||||
:
|
||||
else
|
||||
docdir="$docdir/postgresql"
|
||||
fi
|
||||
|
||||
|
||||
# prepare build tree if outside source tree
|
||||
# Note 1: test -ef might not exist, but it's more reliable than `pwd`.
|
||||
# Note 2: /bin/pwd might be better than shell's built-in at getting
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*-makefile-*-
|
||||
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.185 2004/05/21 05:07:55 tgl Exp $
|
||||
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.186 2004/05/21 20:56:48 tgl Exp $
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# All PostgreSQL makefiles include this file and use the variables it sets,
|
||||
@ -51,53 +51,22 @@ configure_args = @configure_args@
|
||||
##########################################################################
|
||||
#
|
||||
# Installation directories
|
||||
#
|
||||
# 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.
|
||||
|
||||
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))" ""
|
||||
ifeq "$(findstring postgres, $(datadir))" ""
|
||||
override datadir := $(datadir)/postgresql
|
||||
endif
|
||||
endif
|
||||
|
||||
sysconfdir := @sysconfdir@
|
||||
ifeq "$(findstring pgsql, $(sysconfdir))" ""
|
||||
ifeq "$(findstring postgres, $(sysconfdir))" ""
|
||||
override sysconfdir := $(sysconfdir)/postgresql
|
||||
endif
|
||||
endif
|
||||
|
||||
libdir := @libdir@
|
||||
pkglibdir = $(libdir)
|
||||
ifeq "$(findstring pgsql, $(pkglibdir))" ""
|
||||
ifeq "$(findstring postgres, $(pkglibdir))" ""
|
||||
override pkglibdir := $(pkglibdir)/postgresql
|
||||
endif
|
||||
endif
|
||||
pkglibdir := @pkglibdir@
|
||||
|
||||
includedir := @includedir@
|
||||
pkgincludedir = $(includedir)
|
||||
ifeq "$(findstring pgsql, $(pkgincludedir))" ""
|
||||
ifeq "$(findstring postgres, $(pkgincludedir))" ""
|
||||
override pkgincludedir := $(pkgincludedir)/postgresql
|
||||
endif
|
||||
endif
|
||||
pkgincludedir := @pkgincludedir@
|
||||
includedir_server = $(pkgincludedir)/server
|
||||
includedir_internal = $(pkgincludedir)/internal
|
||||
|
||||
@ -105,11 +74,6 @@ mandir := @mandir@
|
||||
sqlmansect_dummy = l
|
||||
|
||||
docdir := @docdir@
|
||||
ifeq "$(findstring pgsql, $(docdir))" ""
|
||||
ifeq "$(findstring postgres, $(docdir))" ""
|
||||
override docdir := $(docdir)/postgresql
|
||||
endif
|
||||
endif
|
||||
|
||||
localedir := @localedir@
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Makefile for utils/fmgr
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $PostgreSQL: pgsql/src/backend/utils/fmgr/Makefile,v 1.16 2004/05/17 14:35:31 momjian Exp $
|
||||
# $PostgreSQL: pgsql/src/backend/utils/fmgr/Makefile,v 1.17 2004/05/21 20:56:49 tgl Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -24,7 +24,3 @@ SUBSYS.o: $(OBJS)
|
||||
|
||||
clean:
|
||||
rm -f SUBSYS.o $(OBJS)
|
||||
|
||||
|
||||
# ensure that changes in PKGLIBDIR propagate to dfmgr.o
|
||||
dfmgr.o: dfmgr.c $(top_builddir)/src/Makefile.global
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.107 2004/05/19 04:21:49 momjian Exp $
|
||||
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.108 2004/05/21 20:56:49 tgl Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -18,14 +18,8 @@ NAME= pq
|
||||
SO_MAJOR_VERSION= 3
|
||||
SO_MINOR_VERSION= 2
|
||||
|
||||
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) $(PTHREAD_CFLAGS) -DFRONTEND -DSYSCONFDIR='"$(sysconfdir)"'
|
||||
override CFLAGS += $(PTHREAD_CFLAGS) \
|
||||
-DPGBINDIR=\"$(bindir)\" \
|
||||
-DPGDATADIR=\"$(datadir)\" \
|
||||
-DSYSCONFDIR='"$(sysconfdir)"' \
|
||||
-DINCLUDEDIR=\"$(includedir)\" \
|
||||
-DPKGINCLUDEDIR=\"$(pkgincludedir)\" \
|
||||
-DPKGLIBDIR=\"$(pkglibdir)\"
|
||||
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) -I$(top_builddir)/src/port -DFRONTEND
|
||||
override CFLAGS += $(PTHREAD_CFLAGS)
|
||||
|
||||
OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \
|
||||
fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o \
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.269 2004/03/24 03:44:59 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.270 2004/05/21 20:56:49 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -29,6 +29,7 @@
|
||||
#include "libpq-fe.h"
|
||||
#include "libpq-int.h"
|
||||
#include "fe-auth.h"
|
||||
#include "pg_config_paths.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include "win32.h"
|
||||
|
@ -7,7 +7,7 @@
|
||||
# with broken/missing library files.
|
||||
|
||||
# IDENTIFICATION
|
||||
# $PostgreSQL: pgsql/src/port/Makefile,v 1.11 2004/05/17 14:35:34 momjian Exp $
|
||||
# $PostgreSQL: pgsql/src/port/Makefile,v 1.12 2004/05/21 20:56:50 tgl Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -15,13 +15,6 @@ subdir = src/port
|
||||
top_builddir = ../..
|
||||
include $(top_builddir)/src/Makefile.global
|
||||
|
||||
override CPPFLAGS += -DPGBINDIR=\"$(bindir)\" \
|
||||
-DPGDATADIR=\"$(datadir)\" \
|
||||
-DSYSCONFDIR='"$(sysconfdir)"' \
|
||||
-DINCLUDEDIR=\"$(includedir)\" \
|
||||
-DPKGINCLUDEDIR=\"$(pkgincludedir)\" \
|
||||
-DPKGLIBDIR=\"$(pkglibdir)\"
|
||||
|
||||
ifdef LIBOBJS
|
||||
all: libpgport.a
|
||||
endif
|
||||
@ -32,5 +25,16 @@ libpgport.a: $(LIBOBJS)
|
||||
thread.o: thread.c
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) $(PTHREAD_CFLAGS) -c $<
|
||||
|
||||
path.o: path.c pg_config_paths.h
|
||||
|
||||
# Dependency is to ensure that path changes propagate
|
||||
pg_config_paths.h: $(top_builddir)/src/Makefile.global
|
||||
echo "#define PGBINDIR \"$(bindir)\"" >$@
|
||||
echo "#define PGSHAREDIR \"$(datadir)\"" >>$@
|
||||
echo "#define SYSCONFDIR \"$(sysconfdir)\"" >>$@
|
||||
echo "#define INCLUDEDIR \"$(includedir)\"" >>$@
|
||||
echo "#define PKGINCLUDEDIR \"$(pkgincludedir)\"" >>$@
|
||||
echo "#define PKGLIBDIR \"$(pkglibdir)\"" >>$@
|
||||
|
||||
clean distclean maintainer-clean:
|
||||
rm -f libpgport.a $(LIBOBJS)
|
||||
rm -f libpgport.a $(LIBOBJS) pg_config_paths.h
|
||||
|
@ -8,14 +8,18 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/port/path.c,v 1.10 2004/05/19 04:21:49 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/port/path.c,v 1.11 2004/05/21 20:56:50 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "c.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "pg_config_paths.h"
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
#define ISSEP(ch) ((ch) == '/')
|
||||
#else
|
||||
@ -109,16 +113,15 @@ get_progname(const char *argv0)
|
||||
void
|
||||
get_share_path(const char *my_exec_path, char *ret_path)
|
||||
{
|
||||
if (relative_path(PGBINDIR, PGDATADIR))
|
||||
if (relative_path(PGBINDIR, PGSHAREDIR))
|
||||
{
|
||||
/* Autoconf calls our /share 'datadir' */
|
||||
StrNCpy(ret_path, my_exec_path, MAXPGPATH);
|
||||
trim_directory(ret_path); /* trim off binary */
|
||||
trim_directory(ret_path); /* trim off /bin */
|
||||
strcat(ret_path, "/share"); /* add /share */
|
||||
}
|
||||
else
|
||||
StrNCpy(ret_path, PGDATADIR, MAXPGPATH);
|
||||
StrNCpy(ret_path, PGSHAREDIR, MAXPGPATH);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user