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
This commit is contained in:
David M. Lee
2013-01-18 21:10:23 +00:00
parent 1752c6279d
commit af6b4fed4f
7 changed files with 5612 additions and 33025 deletions

View File

@@ -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>],