Skip to content

Commit 13f96c4

Browse files
committed
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.
1 parent 748a15a commit 13f96c4

File tree

8 files changed

+138
-68
lines changed

8 files changed

+138
-68
lines changed

configure

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17939,6 +17939,59 @@ CFLAGS="$_CFLAGS"
1793917939
LIBS="$_LIBS"
1794017940
fi
1794117941

17942+
# Adjust installation directories.
17943+
#
17944+
# These are initially set by the equivalent --xxxdir configure options.
17945+
# We append "postgresql" to some of them, if the string does not already
17946+
# contain "pgsql" or "postgres", in order to avoid directory clutter.
17947+
17948+
if echo "$libexecdir" | egrep 'pgsql|postgres' >/dev/null 2>&1
17949+
then
17950+
:
17951+
else
17952+
libexecdir="$libexecdir/postgresql"
17953+
fi
17954+
17955+
if echo "$datadir" | egrep 'pgsql|postgres' >/dev/null 2>&1
17956+
then
17957+
:
17958+
else
17959+
datadir="$datadir/postgresql"
17960+
fi
17961+
17962+
if echo "$sysconfdir" | egrep 'pgsql|postgres' >/dev/null 2>&1
17963+
then
17964+
:
17965+
else
17966+
sysconfdir="$sysconfdir/postgresql"
17967+
fi
17968+
17969+
pkglibdir="$libdir"
17970+
if echo "$pkglibdir" | egrep 'pgsql|postgres' >/dev/null 2>&1
17971+
then
17972+
:
17973+
else
17974+
pkglibdir="$pkglibdir/postgresql"
17975+
fi
17976+
17977+
17978+
pkgincludedir="$includedir"
17979+
if echo "$pkgincludedir" | egrep 'pgsql|postgres' >/dev/null 2>&1
17980+
then
17981+
:
17982+
else
17983+
pkgincludedir="$pkgincludedir/postgresql"
17984+
fi
17985+
17986+
17987+
if echo "$docdir" | egrep 'pgsql|postgres' >/dev/null 2>&1
17988+
then
17989+
:
17990+
else
17991+
docdir="$docdir/postgresql"
17992+
fi
17993+
17994+
1794217995
# prepare build tree if outside source tree
1794317996
# Note 1: test -ef might not exist, but it's more reliable than `pwd`.
1794417997
# 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
1863918692
s,@DOCBOOKSTYLE@,$DOCBOOKSTYLE,;t t
1864018693
s,@COLLATEINDEX@,$COLLATEINDEX,;t t
1864118694
s,@SGMLSPL@,$SGMLSPL,;t t
18695+
s,@pkglibdir@,$pkglibdir,;t t
18696+
s,@pkgincludedir@,$pkgincludedir,;t t
1864218697
s,@vpath_build@,$vpath_build,;t t
1864318698
CEOF
1864418699

configure.in

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.356 2004/05/21 05:07:54 tgl Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.357 2004/05/21 20:56:47 tgl Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -1202,6 +1202,59 @@ CFLAGS="$_CFLAGS"
12021202
LIBS="$_LIBS"
12031203
fi
12041204

1205+
# Adjust installation directories.
1206+
#
1207+
# These are initially set by the equivalent --xxxdir configure options.
1208+
# We append "postgresql" to some of them, if the string does not already
1209+
# contain "pgsql" or "postgres", in order to avoid directory clutter.
1210+
1211+
if echo "$libexecdir" | egrep 'pgsql|postgres' >/dev/null 2>&1
1212+
then
1213+
:
1214+
else
1215+
libexecdir="$libexecdir/postgresql"
1216+
fi
1217+
1218+
if echo "$datadir" | egrep 'pgsql|postgres' >/dev/null 2>&1
1219+
then
1220+
:
1221+
else
1222+
datadir="$datadir/postgresql"
1223+
fi
1224+
1225+
if echo "$sysconfdir" | egrep 'pgsql|postgres' >/dev/null 2>&1
1226+
then
1227+
:
1228+
else
1229+
sysconfdir="$sysconfdir/postgresql"
1230+
fi
1231+
1232+
pkglibdir="$libdir"
1233+
if echo "$pkglibdir" | egrep 'pgsql|postgres' >/dev/null 2>&1
1234+
then
1235+
:
1236+
else
1237+
pkglibdir="$pkglibdir/postgresql"
1238+
fi
1239+
AC_SUBST(pkglibdir)
1240+
1241+
pkgincludedir="$includedir"
1242+
if echo "$pkgincludedir" | egrep 'pgsql|postgres' >/dev/null 2>&1
1243+
then
1244+
:
1245+
else
1246+
pkgincludedir="$pkgincludedir/postgresql"
1247+
fi
1248+
AC_SUBST(pkgincludedir)
1249+
1250+
if echo "$docdir" | egrep 'pgsql|postgres' >/dev/null 2>&1
1251+
then
1252+
:
1253+
else
1254+
docdir="$docdir/postgresql"
1255+
fi
1256+
1257+
12051258
# prepare build tree if outside source tree
12061259
# Note 1: test -ef might not exist, but it's more reliable than `pwd`.
12071260
# Note 2: /bin/pwd might be better than shell's built-in at getting

src/Makefile.global.in

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*-makefile-*-
2-
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.185 2004/05/21 05:07:55 tgl Exp $
2+
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.186 2004/05/21 20:56:48 tgl Exp $
33

44
#------------------------------------------------------------------------------
55
# All PostgreSQL makefiles include this file and use the variables it sets,
@@ -51,65 +51,29 @@ configure_args = @configure_args@
5151
##########################################################################
5252
#
5353
# Installation directories
54-
#
55-
# These are set by the equivalent --xxxdir configure options. We
56-
# append "postgresql" to some of them, if the string does not already
57-
# contain "pgsql" or "postgres", in order to avoid directory clutter.
5854

5955
prefix := @prefix@
6056
exec_prefix := @exec_prefix@
6157

6258
bindir := @bindir@
6359
sbindir := @sbindir@
64-
6560
libexecdir := @libexecdir@
66-
ifeq "$(findstring pgsql, $(libexecdir))" ""
67-
ifeq "$(findstring postgres, $(libexecdir))" ""
68-
override libexecdir := $(libexecdir)/postgresql
69-
endif
70-
endif
7161

7262
datadir := @datadir@
73-
ifeq "$(findstring pgsql, $(datadir))" ""
74-
ifeq "$(findstring postgres, $(datadir))" ""
75-
override datadir := $(datadir)/postgresql
76-
endif
77-
endif
78-
7963
sysconfdir := @sysconfdir@
80-
ifeq "$(findstring pgsql, $(sysconfdir))" ""
81-
ifeq "$(findstring postgres, $(sysconfdir))" ""
82-
override sysconfdir := $(sysconfdir)/postgresql
83-
endif
84-
endif
8564

8665
libdir := @libdir@
87-
pkglibdir = $(libdir)
88-
ifeq "$(findstring pgsql, $(pkglibdir))" ""
89-
ifeq "$(findstring postgres, $(pkglibdir))" ""
90-
override pkglibdir := $(pkglibdir)/postgresql
91-
endif
92-
endif
66+
pkglibdir := @pkglibdir@
9367

9468
includedir := @includedir@
95-
pkgincludedir = $(includedir)
96-
ifeq "$(findstring pgsql, $(pkgincludedir))" ""
97-
ifeq "$(findstring postgres, $(pkgincludedir))" ""
98-
override pkgincludedir := $(pkgincludedir)/postgresql
99-
endif
100-
endif
69+
pkgincludedir := @pkgincludedir@
10170
includedir_server = $(pkgincludedir)/server
10271
includedir_internal = $(pkgincludedir)/internal
10372

10473
mandir := @mandir@
10574
sqlmansect_dummy = l
10675

10776
docdir := @docdir@
108-
ifeq "$(findstring pgsql, $(docdir))" ""
109-
ifeq "$(findstring postgres, $(docdir))" ""
110-
override docdir := $(docdir)/postgresql
111-
endif
112-
endif
11377

11478
localedir := @localedir@
11579

src/backend/utils/fmgr/Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for utils/fmgr
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/utils/fmgr/Makefile,v 1.16 2004/05/17 14:35:31 momjian Exp $
7+
# $PostgreSQL: pgsql/src/backend/utils/fmgr/Makefile,v 1.17 2004/05/21 20:56:49 tgl Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -24,7 +24,3 @@ SUBSYS.o: $(OBJS)
2424

2525
clean:
2626
rm -f SUBSYS.o $(OBJS)
27-
28-
29-
# ensure that changes in PKGLIBDIR propagate to dfmgr.o
30-
dfmgr.o: dfmgr.c $(top_builddir)/src/Makefile.global

src/interfaces/libpq/Makefile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.107 2004/05/19 04:21:49 momjian Exp $
7+
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.108 2004/05/21 20:56:49 tgl Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -18,14 +18,8 @@ NAME= pq
1818
SO_MAJOR_VERSION= 3
1919
SO_MINOR_VERSION= 2
2020

21-
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) $(PTHREAD_CFLAGS) -DFRONTEND -DSYSCONFDIR='"$(sysconfdir)"'
22-
override CFLAGS += $(PTHREAD_CFLAGS) \
23-
-DPGBINDIR=\"$(bindir)\" \
24-
-DPGDATADIR=\"$(datadir)\" \
25-
-DSYSCONFDIR='"$(sysconfdir)"' \
26-
-DINCLUDEDIR=\"$(includedir)\" \
27-
-DPKGINCLUDEDIR=\"$(pkgincludedir)\" \
28-
-DPKGLIBDIR=\"$(pkglibdir)\"
21+
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) -I$(top_builddir)/src/port -DFRONTEND
22+
override CFLAGS += $(PTHREAD_CFLAGS)
2923

3024
OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \
3125
fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o \

src/interfaces/libpq/fe-connect.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.269 2004/03/24 03:44:59 momjian Exp $
11+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.270 2004/05/21 20:56:49 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -29,6 +29,7 @@
2929
#include "libpq-fe.h"
3030
#include "libpq-int.h"
3131
#include "fe-auth.h"
32+
#include "pg_config_paths.h"
3233

3334
#ifdef WIN32
3435
#include "win32.h"

src/port/Makefile

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,14 @@
77
# with broken/missing library files.
88

99
# IDENTIFICATION
10-
# $PostgreSQL: pgsql/src/port/Makefile,v 1.11 2004/05/17 14:35:34 momjian Exp $
10+
# $PostgreSQL: pgsql/src/port/Makefile,v 1.12 2004/05/21 20:56:50 tgl Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313

1414
subdir = src/port
1515
top_builddir = ../..
1616
include $(top_builddir)/src/Makefile.global
1717

18-
override CPPFLAGS += -DPGBINDIR=\"$(bindir)\" \
19-
-DPGDATADIR=\"$(datadir)\" \
20-
-DSYSCONFDIR='"$(sysconfdir)"' \
21-
-DINCLUDEDIR=\"$(includedir)\" \
22-
-DPKGINCLUDEDIR=\"$(pkgincludedir)\" \
23-
-DPKGLIBDIR=\"$(pkglibdir)\"
24-
2518
ifdef LIBOBJS
2619
all: libpgport.a
2720
endif
@@ -32,5 +25,16 @@ libpgport.a: $(LIBOBJS)
3225
thread.o: thread.c
3326
$(CC) $(CFLAGS) $(CPPFLAGS) $(PTHREAD_CFLAGS) -c $<
3427

28+
path.o: path.c pg_config_paths.h
29+
30+
# Dependency is to ensure that path changes propagate
31+
pg_config_paths.h: $(top_builddir)/src/Makefile.global
32+
echo "#define PGBINDIR \"$(bindir)\"" >$@
33+
echo "#define PGSHAREDIR \"$(datadir)\"" >>$@
34+
echo "#define SYSCONFDIR \"$(sysconfdir)\"" >>$@
35+
echo "#define INCLUDEDIR \"$(includedir)\"" >>$@
36+
echo "#define PKGINCLUDEDIR \"$(pkgincludedir)\"" >>$@
37+
echo "#define PKGLIBDIR \"$(pkglibdir)\"" >>$@
38+
3539
clean distclean maintainer-clean:
36-
rm -f libpgport.a $(LIBOBJS)
40+
rm -f libpgport.a $(LIBOBJS) pg_config_paths.h

src/port/path.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/path.c,v 1.10 2004/05/19 04:21:49 momjian Exp $
11+
* $PostgreSQL: pgsql/src/port/path.c,v 1.11 2004/05/21 20:56:50 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
1515

1616
#include "c.h"
17+
1718
#include <ctype.h>
1819

20+
#include "pg_config_paths.h"
21+
22+
1923
#ifndef WIN32
2024
#define ISSEP(ch) ((ch) == '/')
2125
#else
@@ -109,16 +113,15 @@ get_progname(const char *argv0)
109113
void
110114
get_share_path(const char *my_exec_path, char *ret_path)
111115
{
112-
if (relative_path(PGBINDIR, PGDATADIR))
116+
if (relative_path(PGBINDIR, PGSHAREDIR))
113117
{
114-
/* Autoconf calls our /share 'datadir' */
115118
StrNCpy(ret_path, my_exec_path, MAXPGPATH);
116119
trim_directory(ret_path); /* trim off binary */
117120
trim_directory(ret_path); /* trim off /bin */
118121
strcat(ret_path, "/share"); /* add /share */
119122
}
120123
else
121-
StrNCpy(ret_path, PGDATADIR, MAXPGPATH);
124+
StrNCpy(ret_path, PGSHAREDIR, MAXPGPATH);
122125
}
123126

124127

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy