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.
This commit is contained in:
parent
81024e7d80
commit
6707ede813
@ -234,6 +234,13 @@ PGAC_ARG_BOOL(enable, shared, yes,
|
||||
[ --disable-shared do not build shared libraries])
|
||||
AC_SUBST(enable_shared)
|
||||
|
||||
#
|
||||
# '-rpath'-like feature can be disabled
|
||||
#
|
||||
PGAC_ARG_BOOL(enable, rpath, yes,
|
||||
[ --disable-rpath do not embed shared library search path in executables])
|
||||
AC_SUBST(enable_rpath)
|
||||
|
||||
|
||||
#
|
||||
# C compiler
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*-makefile-*-
|
||||
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.105 2000/10/25 16:13:52 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.106 2000/10/27 23:59:39 petere Exp $
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# All PostgreSQL makefiles include this file and use the variables it sets,
|
||||
@ -115,6 +115,7 @@ with_tk = @with_tk@
|
||||
enable_odbc = @enable_odbc@
|
||||
MULTIBYTE = @MULTIBYTE@
|
||||
enable_shared = @enable_shared@
|
||||
enable_rpath = @enable_rpath@
|
||||
|
||||
python_extmakefile = @python_extmakefile@
|
||||
python_moduledir = @python_moduledir@
|
||||
@ -213,6 +214,9 @@ ELF_SYSTEM= @ELF_SYS@
|
||||
# Pull in platform-specific magic
|
||||
include $(top_builddir)/src/Makefile.port
|
||||
|
||||
ifeq ($(enable_rpath), yes)
|
||||
LDFLAGS += $(rpath)
|
||||
endif
|
||||
|
||||
##########################################################################
|
||||
#
|
||||
|
@ -6,7 +6,7 @@
|
||||
# Copyright (c) 1998, Regents of the University of California
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.29 2000/10/27 20:09:48 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.30 2000/10/27 23:59:39 petere Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -137,9 +137,6 @@ ifeq ($(PORTNAME), netbsd)
|
||||
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
|
||||
ifdef ELF_SYSTEM
|
||||
LINK.shared = $(COMPILER) -shared -Wl,-soname -Wl,$(soname)
|
||||
ifneq ($(SHLIB_LINK),)
|
||||
LINK.shared += -Wl,-R$(libdir)
|
||||
endif
|
||||
else
|
||||
LINK.shared = $(LD) -x -Bshareable -Bforcearchive
|
||||
endif
|
||||
@ -148,12 +145,12 @@ endif
|
||||
ifeq ($(PORTNAME), hpux)
|
||||
# HPUX doesn't believe in version numbers for shlibs
|
||||
shlib := lib$(NAME)$(DLSUFFIX)
|
||||
LINK.shared = $(LD) -b
|
||||
LINK.shared = $(LD) -b +b $(libdir)
|
||||
endif
|
||||
|
||||
ifeq ($(PORTNAME), irix5)
|
||||
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
|
||||
LINK.shared := $(COMPILER) -shared -rpath $(libdir) -set_version sgi$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
|
||||
LINK.shared = $(COMPILER) -shared -set_version sgi$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
|
||||
endif
|
||||
|
||||
ifeq ($(PORTNAME), linux)
|
||||
@ -197,6 +194,7 @@ ifeq ($(PORTNAME), unixware)
|
||||
LINK.shared = $(CXX) -G
|
||||
endif
|
||||
endif
|
||||
LINK.shared += -Wl,-z,text
|
||||
endif
|
||||
|
||||
ifeq ($(PORTNAME), win)
|
||||
@ -215,6 +213,10 @@ endif
|
||||
# Pull in any extra -L options that the user might have specified.
|
||||
SHLIB_LINK := $(filter -L%, $(LDFLAGS)) $(SHLIB_LINK)
|
||||
|
||||
ifeq ($(enable_rpath), yes)
|
||||
SHLIB_LINK += $(rpath)
|
||||
endif
|
||||
|
||||
endif # enable_shared
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@ AROPT = cq
|
||||
|
||||
ifdef ELF_SYSTEM
|
||||
export_dynamic = -export-dynamic
|
||||
rpath = -R$(libdir)
|
||||
endif
|
||||
|
||||
DLSUFFIX = .so
|
||||
|
@ -2,13 +2,13 @@
|
||||
# which we do by linking -lc before -lcurses. (Unfortunately we can't
|
||||
# just not use libcurses.) This also ensures that we get the POSIX signal
|
||||
# routines in libc, not the BSD-like ones in libBSD.
|
||||
LDFLAGS:= -lc $(LDFLAGS)
|
||||
LIBS := -lc $(LIBS)
|
||||
|
||||
# On the other hand, if we don't have POSIX signals, we need to use the
|
||||
# libBSD signal routines. (HPUX 9 and early HPUX 10 releases don't have
|
||||
# POSIX signals.) Make sure libBSD comes before libc in that case.
|
||||
ifeq ($(HAVE_POSIX_SIGNALS), no)
|
||||
LDFLAGS:= -lBSD $(LDFLAGS)
|
||||
LIBS := -lBSD $(LIBS)
|
||||
endif
|
||||
|
||||
# On HPUX 9, rint() is provided only in the PA1.1 version of libm.
|
||||
@ -19,11 +19,15 @@ ifneq ($(HPUXMATHLIB),)
|
||||
LDFLAGS:= -L /lib/pa1.1 $(LDFLAGS)
|
||||
endif
|
||||
|
||||
# On all HPUX versions, embed `libdir' as the shared library search path
|
||||
# so that the executables don't need SHLIB_PATH to be set, specify -z
|
||||
# to catch null pointer dereferences, and specify -E to make all symbols
|
||||
# visible to dynamically linked shared libraries.
|
||||
LDFLAGS+= -Wl,+b -Wl,$(libdir) -Wl,-z
|
||||
# Embed 'libdir' as the shared library search path so that the executables
|
||||
# don't need SHLIB_PATH to be set. (We do not observe the --enable-rpath
|
||||
# switch here because you'd get rather bizarre behavior if you leave this
|
||||
# option off.)
|
||||
LDFLAGS += -Wl,+b -Wl,$(libdir)
|
||||
|
||||
# catch null pointer dereferences
|
||||
LDFLAGS += -Wl,-z
|
||||
|
||||
export_dynamic = -Wl,-E
|
||||
|
||||
AROPT = crs
|
||||
|
@ -2,6 +2,7 @@
|
||||
RANLIB= touch
|
||||
MK_NO_LORDER= true
|
||||
AROPT = crs
|
||||
rpath = -Wl,-rpath,$(libdir)
|
||||
|
||||
DLSUFFIX = .so
|
||||
CFLAGS_SL =
|
||||
|
@ -1,5 +1,6 @@
|
||||
AROPT = crs
|
||||
export_dynamic = -export-dynamic
|
||||
rpath = -Wl,-rpath,$(libdir)
|
||||
DLSUFFIX = .so
|
||||
CFLAGS_SL = -fpic
|
||||
|
||||
|
@ -2,6 +2,7 @@ AROPT = cq
|
||||
|
||||
ifdef ELF_SYSTEM
|
||||
export_dynamic = -Wl,-E
|
||||
rpath = -Wl,-R$(libdir)
|
||||
endif
|
||||
|
||||
DLSUFFIX = .so
|
||||
|
@ -2,6 +2,7 @@ AROPT = cq
|
||||
|
||||
ifdef ELF_SYSTEM
|
||||
export_dynamic = -Wl,-E
|
||||
rpath = -R$(libdir)
|
||||
endif
|
||||
|
||||
DLSUFFIX = .so
|
||||
|
@ -1,8 +1,7 @@
|
||||
AROPT = crs
|
||||
DLSUFFIX = .so
|
||||
CFLAGS_SL =
|
||||
rpath = -rpath $(libdir)
|
||||
|
||||
%.so: %.o
|
||||
$(LD) -shared -expect_unresolved '*' -o $@ $<
|
||||
|
||||
LDFLAGS += -rpath $(libdir)
|
||||
|
@ -1,11 +1,15 @@
|
||||
# $Header: /cvsroot/pgsql/src/makefiles/Makefile.solaris,v 1.3 2000/10/21 22:36:13 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/makefiles/Makefile.solaris,v 1.4 2000/10/27 23:59:39 petere Exp $
|
||||
|
||||
AROPT = crs
|
||||
|
||||
ifeq ($(with_gnu_ld), yes)
|
||||
export_dynamic = -Wl,-E
|
||||
rpath = -Wl,-rpath,$(libdir)
|
||||
else
|
||||
rpath = -Wl,-R$(libdir)
|
||||
endif
|
||||
|
||||
|
||||
DLSUFFIX = .so
|
||||
ifeq ($(GCC), yes)
|
||||
CFLAGS_SL = -fPIC
|
||||
|
@ -1,5 +1,6 @@
|
||||
AROPT = crs
|
||||
export_dynamic = -Wl,-Bexport
|
||||
rpath = -Wl,-R$(libdir)
|
||||
DLSUFFIX = .so
|
||||
ifeq ($(GCC), yes)
|
||||
CFLAGS_SL = -fpic
|
||||
|
Loading…
Reference in New Issue
Block a user