Use --enable-new-dtags to set RUNPATH rather than RPATH so that LD_LIBRARY_PATH is not overridden by the application.
authorSam Lantinga <slouken@libsdl.org>
Thu, 07 Jan 2016 16:42:30 -0800
changeset 1004324e8d042e532
parent 10042 8546f8015052
child 10044 8fc20bbbed5c
Use --enable-new-dtags to set RUNPATH rather than RPATH so that LD_LIBRARY_PATH is not overridden by the application.
CMakeLists.txt
configure
configure.in
     1.1 --- a/CMakeLists.txt	Thu Jan 07 16:01:24 2016 -0500
     1.2 +++ b/CMakeLists.txt	Thu Jan 07 16:42:30 2016 -0800
     1.3 @@ -958,6 +958,12 @@
     1.4      set(SDL_RLD_FLAGS "")
     1.5      if(BSDI OR FREEBSD OR LINUX OR NETBSD)
     1.6        set(SDL_RLD_FLAGS "-Wl,-rpath,\${libdir}")
     1.7 +      set(CMAKE_REQUIRED_FLAGS "-Wl,--enable-new-dtags")
     1.8 +      check_c_compiler_flag("" HAVE_ENABLE_NEW_DTAGS)
     1.9 +      set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
    1.10 +      if(HAVE_ENABLE_NEW_DTAGS)
    1.11 +        list(APPEND SDL_RLD_FLAGS "-Wl,--enable-new-dtags")
    1.12 +      endif()
    1.13      elseif(SOLARIS)
    1.14        set(SDL_RLD_FLAGS "-R\${libdir}")
    1.15      endif()
     2.1 --- a/configure	Thu Jan 07 16:01:24 2016 -0500
     2.2 +++ b/configure	Thu Jan 07 16:42:30 2016 -0800
     2.3 @@ -23763,6 +23763,36 @@
     2.4  if test "x$enable_rpath" = "xyes"; then
     2.5    if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
     2.6      SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
     2.7 +
     2.8 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --enable-new-dtags" >&5
     2.9 +$as_echo_n "checking for linker option --enable-new-dtags... " >&6; }
    2.10 +    have_enable_new_dtags=no
    2.11 +    save_LDFLAGS="$LDFLAGS"
    2.12 +    LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags"
    2.13 +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    2.14 +/* end confdefs.h.  */
    2.15 +
    2.16 +
    2.17 +int
    2.18 +main ()
    2.19 +{
    2.20 +
    2.21 +
    2.22 +  ;
    2.23 +  return 0;
    2.24 +}
    2.25 +_ACEOF
    2.26 +if ac_fn_c_try_link "$LINENO"; then :
    2.27 +
    2.28 +    have_enable_new_dtags=yes
    2.29 +    SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags"
    2.30 +
    2.31 +fi
    2.32 +rm -f core conftest.err conftest.$ac_objext \
    2.33 +    conftest$ac_exeext conftest.$ac_ext
    2.34 +    LDFLAGS="$save_LDFLAGS"
    2.35 +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_enable_new_dtags" >&5
    2.36 +$as_echo "$have_enable_new_dtags" >&6; }
    2.37    fi
    2.38    if test $ARCH = solaris; then
    2.39      SDL_RLD_FLAGS="-R\${libdir}"
     3.1 --- a/configure.in	Thu Jan 07 16:01:24 2016 -0500
     3.2 +++ b/configure.in	Thu Jan 07 16:42:30 2016 -0800
     3.3 @@ -3516,6 +3516,19 @@
     3.4  if test "x$enable_rpath" = "xyes"; then
     3.5    if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
     3.6      SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
     3.7 +
     3.8 +    AC_MSG_CHECKING(for linker option --enable-new-dtags)
     3.9 +    have_enable_new_dtags=no
    3.10 +    save_LDFLAGS="$LDFLAGS"
    3.11 +    LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags"
    3.12 +    AC_TRY_LINK([
    3.13 +    ],[
    3.14 +    ],[
    3.15 +    have_enable_new_dtags=yes
    3.16 +    SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags"
    3.17 +    ])
    3.18 +    LDFLAGS="$save_LDFLAGS"
    3.19 +    AC_MSG_RESULT($have_enable_new_dtags)
    3.20    fi
    3.21    if test $ARCH = solaris; then
    3.22      SDL_RLD_FLAGS="-R\${libdir}"