Specify the -rpath linker flag when prefix != /usr.

This allows Asterisk to start without having to specify the
LD_LIBRARY_PATH. This can be disabled by passing --disable-rpath to
configure.

(closes issue ASTERISK-20407)
Reported by: David M. Lee
Review: https://reviewboard.asterisk.org/r/2132/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@379475 65c4cc65-6c06-0410-ace0-fbb531ad65f3
changes/61/61/1
David M. Lee 12 years ago
parent 1752c6279d
commit af6b4fed4f

@ -252,7 +252,7 @@ MOD_SUBDIRS_MENUSELECT_TREE:=$(MOD_SUBDIRS:%=%-menuselect-tree)
ifneq ($(findstring darwin,$(OSARCH)),)
_ASTCFLAGS+=-D__Darwin__
_SOLINK=-Xlinker -macosx_version_min -Xlinker 10.4 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace
_SOLINK=-Xlinker -macosx_version_min -Xlinker 10.4 -Xlinker -undefined -Xlinker dynamic_lookup
ifeq ($(shell if test `/usr/bin/sw_vers -productVersion | cut -c4` -gt 5; then echo 6; else echo 0; fi),6)
_SOLINK+=/usr/lib/bundle1.o
endif
@ -268,6 +268,9 @@ else
endif
endif
# Include rpath settings
_ASTLDFLAGS+=$(AST_RPATH)
ifeq ($(OSARCH),SunOS)
SOLINK=-shared -fpic -L/usr/local/ssl/lib -lrt
DYLINK=$(SOLINK)

@ -20,6 +20,14 @@
===
===========================================================
From 11.2 to 11.3:
* Now by default, when Asterisk is installed in a path other than /usr, the
Asterisk binary will search for shared libraries in ${libdir} in addition to
searching system libraries. This allows Asterisk to find its shared
libraries without having to specify LD_LIBRARY_PATH. This can be disabled by
passing --disable-rpath to configure.
From 11.1 to 11.2:
* Asterisk has always had code to ignore dash '-' characters that are not

43066
configure vendored

File diff suppressed because it is too large Load Diff

@ -1052,6 +1052,38 @@ AC_COMPILE_IFELSE(
)
AC_SUBST(AST_NESTED_FUNCTIONS)
dnl Check to see if rpath should be set in LDFLAGS
AC_ARG_ENABLE(rpath,
[AC_HELP_STRING([--disable-rpath],
[Disables rpath linker option checking])],
[case "${enableval}" in
y|ye|yes) check_rpath=yes ;;
n|no) check_rpath=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-rpath) ;;
esac], [check_rpath=yes])
AC_MSG_CHECKING(whether to use rpath)
AST_RPATH=
if test "${check_rpath}" != yes; then
AC_MSG_RESULT(skipped)
elif test "${prefix}" = /usr || test "${prefix}" = NONE; then
AC_MSG_RESULT(not needed)
else
case "${host_os}" in
darwin*)
AC_MSG_RESULT(not supported)
# We set macosx_version_min to 10.4, which doesn't
# support rpath. However, we set install_name on our
# dylibs, so it's not strictly necessary.
;;
*)
AC_MSG_RESULT(required)
AST_RPATH="-Wl,-rpath,${libdir}"
;;
esac
fi
AC_SUBST(AST_RPATH)
AC_MSG_CHECKING(for sysinfo)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <sys/sysinfo.h>],

@ -848,19 +848,19 @@
/* Define to 1 if you have the `strtoq' function. */
#undef HAVE_STRTOQ
/* Define to 1 if `ifr_ifru.ifru_hwaddr' is member of `struct ifreq'. */
/* Define to 1 if `ifr_ifru.ifru_hwaddr' is a member of `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR
/* Define to 1 if `uid' is member of `struct sockpeercred'. */
/* Define to 1 if `uid' is a member of `struct sockpeercred'. */
#undef HAVE_STRUCT_SOCKPEERCRED_UID
/* Define to 1 if `st_blksize' is member of `struct stat'. */
/* Define to 1 if `st_blksize' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BLKSIZE
/* Define to 1 if `cr_uid' is member of `struct ucred'. */
/* Define to 1 if `cr_uid' is a member of `struct ucred'. */
#undef HAVE_STRUCT_UCRED_CR_UID
/* Define to 1 if `uid' is member of `struct ucred'. */
/* Define to 1 if `uid' is a member of `struct ucred'. */
#undef HAVE_STRUCT_UCRED_UID
/* Define to 1 if you have the mISDN Supplemental Services library. */
@ -1138,6 +1138,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
@ -1220,6 +1223,11 @@
/* Define to 1 if running on Darwin. */
#undef _DARWIN_UNLIMITED_SELECT
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS

@ -225,6 +225,9 @@ $(ASTSSL_LIB): $(ASTSSL_LIB).$(ASTSSL_SO_VERSION)
else # Darwin
ASTSSL_LIB:=libasteriskssl.dylib
# -install_name allows library to be found if installed somewhere other than
# /lib or /usr/lib
$(ASTSSL_LIB): _ASTLDFLAGS+=-dynamiclib -install_name $(ASTLIBDIR)/$(ASTSSL_LIB)
$(ASTSSL_LIB): _ASTCFLAGS+=-fPIC -DAST_MODULE=\"asteriskssl\"
$(ASTSSL_LIB): LIBS+=$(ASTSSL_LIBS)
$(ASTSSL_LIB): SOLINK=$(DYLINK)

@ -107,6 +107,7 @@ AST_TRAMPOLINES=@AST_TRAMPOLINES@
AST_NO_STRICT_OVERFLOW=@AST_NO_STRICT_OVERFLOW@
AST_SHADOW_WARNINGS=@AST_SHADOW_WARNINGS@
AST_NESTED_FUNCTIONS=@AST_NESTED_FUNCTIONS@
AST_RPATH=@AST_RPATH@
AST_FORTIFY_SOURCE=@AST_FORTIFY_SOURCE@
AST_MARCH_NATIVE=@AST_MARCH_NATIVE@

Loading…
Cancel
Save