summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2013-01-18 21:35:09 +0000
committerDavid M. Lee <dlee@digium.com>2013-01-18 21:35:09 +0000
commit7bd50bc0c4e27adbbc619a74bd22fb6bf7333321 (patch)
tree70eade721ba432c963a443c367f211b9bb8826a4 /configure.ac
parent0fd34b8c0a01827880555239354cca8746782c83 (diff)
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/ ........ Merged revisions 379475 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379477 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac32
1 files changed, 32 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 536d4425f..b5f4d29a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1054,6 +1054,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>],