Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6707ede

Browse files
committed
Make use of system-specific linker option to embed shared library search
path into executables and shared libraries (-rpath or -R for most). Can be disabled with --disable-rpath, since some binary packaging standards do not like this option.
1 parent 81024e7 commit 6707ede

13 files changed

+434
-382
lines changed

configure

+391-365
Large diffs are not rendered by default.

configure.in

+7
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,13 @@ PGAC_ARG_BOOL(enable, shared, yes,
234234
[ --disable-shared do not build shared libraries])
235235
AC_SUBST(enable_shared)
236236

237+
#
238+
# '-rpath'-like feature can be disabled
239+
#
240+
PGAC_ARG_BOOL(enable, rpath, yes,
241+
[ --disable-rpath do not embed shared library search path in executables])
242+
AC_SUBST(enable_rpath)
243+
237244

238245
#
239246
# C compiler

src/Makefile.global.in

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*-makefile-*-
2-
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.105 2000/10/25 16:13:52 petere Exp $
2+
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.106 2000/10/27 23:59:39 petere Exp $
33

44
#------------------------------------------------------------------------------
55
# All PostgreSQL makefiles include this file and use the variables it sets,
@@ -115,6 +115,7 @@ with_tk = @with_tk@
115115
enable_odbc = @enable_odbc@
116116
MULTIBYTE = @MULTIBYTE@
117117
enable_shared = @enable_shared@
118+
enable_rpath = @enable_rpath@
118119

119120
python_extmakefile = @python_extmakefile@
120121
python_moduledir = @python_moduledir@
@@ -213,6 +214,9 @@ ELF_SYSTEM= @ELF_SYS@
213214
# Pull in platform-specific magic
214215
include $(top_builddir)/src/Makefile.port
215216

217+
ifeq ($(enable_rpath), yes)
218+
LDFLAGS += $(rpath)
219+
endif
216220

217221
##########################################################################
218222
#

src/Makefile.shlib

+8-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Copyright (c) 1998, Regents of the University of California
77
#
88
# IDENTIFICATION
9-
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.29 2000/10/27 20:09:48 petere Exp $
9+
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.30 2000/10/27 23:59:39 petere Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

@@ -137,9 +137,6 @@ ifeq ($(PORTNAME), netbsd)
137137
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
138138
ifdef ELF_SYSTEM
139139
LINK.shared = $(COMPILER) -shared -Wl,-soname -Wl,$(soname)
140-
ifneq ($(SHLIB_LINK),)
141-
LINK.shared += -Wl,-R$(libdir)
142-
endif
143140
else
144141
LINK.shared = $(LD) -x -Bshareable -Bforcearchive
145142
endif
@@ -148,12 +145,12 @@ endif
148145
ifeq ($(PORTNAME), hpux)
149146
# HPUX doesn't believe in version numbers for shlibs
150147
shlib := lib$(NAME)$(DLSUFFIX)
151-
LINK.shared = $(LD) -b
148+
LINK.shared = $(LD) -b +b $(libdir)
152149
endif
153150

154151
ifeq ($(PORTNAME), irix5)
155152
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
156-
LINK.shared := $(COMPILER) -shared -rpath $(libdir) -set_version sgi$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
153+
LINK.shared = $(COMPILER) -shared -set_version sgi$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
157154
endif
158155

159156
ifeq ($(PORTNAME), linux)
@@ -197,6 +194,7 @@ ifeq ($(PORTNAME), unixware)
197194
LINK.shared = $(CXX) -G
198195
endif
199196
endif
197+
LINK.shared += -Wl,-z,text
200198
endif
201199

202200
ifeq ($(PORTNAME), win)
@@ -215,6 +213,10 @@ endif
215213
# Pull in any extra -L options that the user might have specified.
216214
SHLIB_LINK := $(filter -L%, $(LDFLAGS)) $(SHLIB_LINK)
217215

216+
ifeq ($(enable_rpath), yes)
217+
SHLIB_LINK += $(rpath)
218+
endif
219+
218220
endif # enable_shared
219221

220222

src/makefiles/Makefile.freebsd

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ AROPT = cq
22

33
ifdef ELF_SYSTEM
44
export_dynamic = -export-dynamic
5+
rpath = -R$(libdir)
56
endif
67

78
DLSUFFIX = .so

src/makefiles/Makefile.hpux

+11-7
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
# which we do by linking -lc before -lcurses. (Unfortunately we can't
33
# just not use libcurses.) This also ensures that we get the POSIX signal
44
# routines in libc, not the BSD-like ones in libBSD.
5-
LDFLAGS:= -lc $(LDFLAGS)
5+
LIBS := -lc $(LIBS)
66

77
# On the other hand, if we don't have POSIX signals, we need to use the
88
# libBSD signal routines. (HPUX 9 and early HPUX 10 releases don't have
99
# POSIX signals.) Make sure libBSD comes before libc in that case.
1010
ifeq ($(HAVE_POSIX_SIGNALS), no)
11-
LDFLAGS:= -lBSD $(LDFLAGS)
11+
LIBS := -lBSD $(LIBS)
1212
endif
1313

1414
# On HPUX 9, rint() is provided only in the PA1.1 version of libm.
@@ -19,11 +19,15 @@ ifneq ($(HPUXMATHLIB),)
1919
LDFLAGS:= -L /lib/pa1.1 $(LDFLAGS)
2020
endif
2121

22-
# On all HPUX versions, embed `libdir' as the shared library search path
23-
# so that the executables don't need SHLIB_PATH to be set, specify -z
24-
# to catch null pointer dereferences, and specify -E to make all symbols
25-
# visible to dynamically linked shared libraries.
26-
LDFLAGS+= -Wl,+b -Wl,$(libdir) -Wl,-z
22+
# Embed 'libdir' as the shared library search path so that the executables
23+
# don't need SHLIB_PATH to be set. (We do not observe the --enable-rpath
24+
# switch here because you'd get rather bizarre behavior if you leave this
25+
# option off.)
26+
LDFLAGS += -Wl,+b -Wl,$(libdir)
27+
28+
# catch null pointer dereferences
29+
LDFLAGS += -Wl,-z
30+
2731
export_dynamic = -Wl,-E
2832

2933
AROPT = crs

src/makefiles/Makefile.irix5

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
RANLIB= touch
33
MK_NO_LORDER= true
44
AROPT = crs
5+
rpath = -Wl,-rpath,$(libdir)
56

67
DLSUFFIX = .so
78
CFLAGS_SL =

src/makefiles/Makefile.linux

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
AROPT = crs
22
export_dynamic = -export-dynamic
3+
rpath = -Wl,-rpath,$(libdir)
34
DLSUFFIX = .so
45
CFLAGS_SL = -fpic
56

src/makefiles/Makefile.netbsd

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ AROPT = cq
22

33
ifdef ELF_SYSTEM
44
export_dynamic = -Wl,-E
5+
rpath = -Wl,-R$(libdir)
56
endif
67

78
DLSUFFIX = .so

src/makefiles/Makefile.openbsd

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ AROPT = cq
22

33
ifdef ELF_SYSTEM
44
export_dynamic = -Wl,-E
5+
rpath = -R$(libdir)
56
endif
67

78
DLSUFFIX = .so

src/makefiles/Makefile.osf

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
AROPT = crs
22
DLSUFFIX = .so
33
CFLAGS_SL =
4+
rpath = -rpath $(libdir)
45

56
%.so: %.o
67
$(LD) -shared -expect_unresolved '*' -o $@ $<
7-
8-
LDFLAGS += -rpath $(libdir)

src/makefiles/Makefile.solaris

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
# $Header: /cvsroot/pgsql/src/makefiles/Makefile.solaris,v 1.3 2000/10/21 22:36:13 petere Exp $
1+
# $Header: /cvsroot/pgsql/src/makefiles/Makefile.solaris,v 1.4 2000/10/27 23:59:39 petere Exp $
22

33
AROPT = crs
44

55
ifeq ($(with_gnu_ld), yes)
66
export_dynamic = -Wl,-E
7+
rpath = -Wl,-rpath,$(libdir)
8+
else
9+
rpath = -Wl,-R$(libdir)
710
endif
811

12+
913
DLSUFFIX = .so
1014
ifeq ($(GCC), yes)
1115
CFLAGS_SL = -fPIC

src/makefiles/Makefile.unixware

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
AROPT = crs
22
export_dynamic = -Wl,-Bexport
3+
rpath = -Wl,-R$(libdir)
34
DLSUFFIX = .so
45
ifeq ($(GCC), yes)
56
CFLAGS_SL = -fpic

0 commit comments

Comments
 (0)