Skip to content

Commit f295419

Browse files
committed
Add --disable-rpath switch to avoid hardcoded path
1 parent 02ad1f7 commit f295419

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

configure.ac

+12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects tar-pax])
44
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
55
LT_INIT
66

7+
# Check if we should disable rpath.
8+
#
9+
# For advanced users: In certain configurations, the rpath attributes
10+
# added by libtool cause problems as rpath will be preferred over
11+
# LD_LIBRARY_PATH. This does not seem to be a problem with
12+
# clang. When using --disable-rpath you will likely need to set
13+
# LD_LIBRARY_PATH if you are using libraries in non-system locations.
14+
# YMMV.
15+
#
16+
17+
DISABLE_RPATH
18+
719
AC_PROG_CXX
820
AC_LANG(C++)
921

m4/disable-rpath.m4

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
dnl file : m4/disable-rpath.m4
2+
dnl author : Boris Kolpackov <[email protected]>
3+
dnl copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
4+
dnl license : GNU GPL v2; see accompanying LICENSE file
5+
dnl
6+
AC_DEFUN([DISABLE_RPATH],[
7+
8+
AC_MSG_CHECKING([whether to use rpath])
9+
AC_ARG_ENABLE(
10+
[rpath],
11+
[AC_HELP_STRING([--disable-rpath], [patch libtool to not use rpath])],
12+
[libtool_rpath="$enable_rpath"],
13+
[libtool_rpath="yes"])
14+
AC_MSG_RESULT($libtool_rpath)
15+
16+
# Patch libtool to not use rpath if requested.
17+
#
18+
AC_CONFIG_COMMANDS(
19+
[libtool-rpath-patch],
20+
[if test "$libtool_use_rpath" = "no"; then
21+
sed < libtool > libtool-2 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_NO_RPATH__ "/'
22+
mv libtool-2 libtool
23+
chmod 755 libtool
24+
fi],
25+
[libtool_use_rpath=$libtool_rpath])
26+
])dnl
27+

0 commit comments

Comments
 (0)