diff options
author | Adam Tkac <atkac@redhat.com> | 2013-01-10 18:04:04 +0100 |
---|---|---|
committer | JINMEI Tatuya <jinmei@isc.org> | 2013-01-31 22:56:21 +0100 |
commit | 1c50c5a6ee7e9675e3ab154f2c7f975ef519fca2 (patch) | |
tree | 7c1a02c351d2e5461e5a5a5d5b3b996542da9984 /examples | |
parent | [master] DHCP4_SERVERID_LOADED and DHCP6_SERVERID_LOADED need server-id too (diff) | |
download | kea-1c50c5a6ee7e9675e3ab154f2c7f975ef519fca2.tar.xz kea-1c50c5a6ee7e9675e3ab154f2c7f975ef519fca2.zip |
[2667] Add --disable-rpath configure switch.
Some dynamic linkers are wise enough (at least the Linux one) to correctly pick
needed shared libraries without hardcoded rpath. The --disable-rpath configure
switch allows distributors to avoid hardcoded rpath paths in libraries and
executables.
Signed-off-by: Adam Tkac <atkac@redhat.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/m4/ax_isc_rpath.m4 | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/examples/m4/ax_isc_rpath.m4 b/examples/m4/ax_isc_rpath.m4 index 91d9b8af1f..85d55f9836 100644 --- a/examples/m4/ax_isc_rpath.m4 +++ b/examples/m4/ax_isc_rpath.m4 @@ -9,38 +9,46 @@ dnl the found option flag. The main configure.ac can use it as follows: dnl if test "x$ISC_RPATH_FLAG" != "x"; then dnl LDFLAGS="$LDFLAGS ${ISC_RPATH_FLAG}/usr/local/lib/some_library" dnl fi +dnl +dnl If you pass --disable-rpath to configure, ISC_RPATH_FLAG is not set AC_DEFUN([AX_ISC_RPATH], [ -# We'll tweak both CXXFLAGS and CCFLAGS so this function will work whichever -# language is used in the main script. Note also that it's not LDFLAGS; -# technically this is a linker flag, but we've noticed $LDFLAGS can be placed -# where the compiler could interpret it as a compiler option, leading to -# subtle failure mode. So, in the check below using the compiler flag is -# safer (in the actual Makefiles the flag should be set in LDFLAGS). -CXXFLAGS_SAVED="$CXXFLAGS" -CXXFLAGS="$CXXFLAGS -Wl,-R/usr/lib" -CCFLAGS_SAVED="$CCFLAGS" -CCFLAGS="$CCFLAGS -Wl,-R/usr/lib" +AC_ARG_ENABLE(rpath, + [AC_HELP_STRING([--disable-rpath], [don't hardcode library path into binaries])], + rpath=$enableval, rpath=yes) + +if test x$rpath != xno; then + # We'll tweak both CXXFLAGS and CCFLAGS so this function will work whichever + # language is used in the main script. Note also that it's not LDFLAGS; + # technically this is a linker flag, but we've noticed $LDFLAGS can be placed + # where the compiler could interpret it as a compiler option, leading to + # subtle failure mode. So, in the check below using the compiler flag is + # safer (in the actual Makefiles the flag should be set in LDFLAGS). + CXXFLAGS_SAVED="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -Wl,-R/usr/lib" + CCFLAGS_SAVED="$CCFLAGS" + CCFLAGS="$CCFLAGS -Wl,-R/usr/lib" -# check -Wl,-R and -R rather than gcc specific -rpath to be as portable -# as possible. -Wl,-R seems to be safer, so we try it first. In some cases -# -R is not actually recognized but AC_TRY_LINK doesn't fail due to that. -AC_MSG_CHECKING([whether -Wl,-R flag is available in linker]) -AC_TRY_LINK([],[], - [ AC_MSG_RESULT(yes) - ISC_RPATH_FLAG=-Wl,-R - ],[ AC_MSG_RESULT(no) - AC_MSG_CHECKING([whether -R flag is available in linker]) - CXXFLAGS="$CXXFLAGS_SAVED -R" - CCFLAGS="$CCFLAGS_SAVED -R" + # check -Wl,-R and -R rather than gcc specific -rpath to be as portable + # as possible. -Wl,-R seems to be safer, so we try it first. In some cases + # -R is not actually recognized but AC_TRY_LINK doesn't fail due to that. + AC_MSG_CHECKING([whether -Wl,-R flag is available in linker]) + AC_TRY_LINK([],[], + [ AC_MSG_RESULT(yes) + ISC_RPATH_FLAG=-Wl,-R + ],[ AC_MSG_RESULT(no) + AC_MSG_CHECKING([whether -R flag is available in linker]) + CXXFLAGS="$CXXFLAGS_SAVED -R" + CCFLAGS="$CCFLAGS_SAVED -R" AC_TRY_LINK([], [], [ AC_MSG_RESULT([yes; note that -R is more sensitive about the position in option arguments]) ISC_RPATH_FLAG=-R ],[ AC_MSG_RESULT(no) ]) - ]) + ]) -CXXFLAGS=$CXXFLAGS_SAVED -CCFLAGS=$CCFLAGS_SAVED + CXXFLAGS=$CXXFLAGS_SAVED + CCFLAGS=$CCFLAGS_SAVED +fi ])dnl AX_ISC_RPATH |