Darren Tucker
2019-Jan-20 22:19 UTC
configure.ac: convert --with-rpath from boolean to argument
Hi folks. For reasons, I want to be able to specify the runtime shared libary path when using clang. Configure assumes that using a bare "-R" does this, however it looks like clang doesn't support this, so I'd like to be able to specify the flag that does work at configure time. This replaces $need_dash_r (boolean) with $rpath_opt (string). Fortunately most of the checks were already for zero/nonzero lengths so those don't change much. This lets me do: ./configure --with-ssl-dir=/some/path --with-rpath=-Wl,-rpath, It might be possible to also roll the somewhat-similar AIX blibpath into this however the semantics are slightly different and I can't currently test it so that can be looked at later. diff --git a/configure.ac b/configure.ac index 8e92d159..e15e25f6 100644 --- a/configure.ac +++ b/configure.ac @@ -285,10 +285,11 @@ AC_ARG_WITH([rpath], [ --without-rpath Disable auto-added -R linker paths], [ if test "x$withval" = "xno" ; then - need_dash_r="" - fi - if test "x$withval" = "xyes" ; then - need_dash_r=1 + rpath_opt="" + elif test "x$withval" = "xyes" ; then + rpath_opt="-R" + else + rpath_opt="$withval" fi ] ) @@ -911,7 +912,7 @@ mips-sony-bsd|mips-sony-newsos4) *-*-netbsd*) check_for_libcrypt_before=1 if test "x$withval" != "xno" ; then - need_dash_r=1 + rpath_opt="-R" fi CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE" AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way]) @@ -962,7 +963,7 @@ mips-sony-bsd|mips-sony-newsos4) ;; *-*-solaris*) if test "x$withval" != "xno" ; then - need_dash_r=1 + rpath_opt="-R" fi AC_DEFINE([PAM_SUN_CODEBASE]) AC_DEFINE([LOGIN_NEEDS_UTMPX]) @@ -1263,14 +1264,14 @@ AC_ARG_WITH([zlib], AC_MSG_ERROR([*** zlib is required ***]) elif test "x$withval" != "xyes"; then if test -d "$withval/lib"; then - if test -n "${need_dash_r}"; then - LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}" + if test -n "${rpath_opt}"; then + LDFLAGS="-L${withval}/lib ${rpath_opt}${withval}/lib ${LDFLAGS}" else LDFLAGS="-L${withval}/lib ${LDFLAGS}" fi else - if test -n "${need_dash_r}"; then - LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}" + if test -n "${rpath_opt}"; then + LDFLAGS="-L${withval} ${rpath_opt}${withval} ${LDFLAGS}" else LDFLAGS="-L${withval} ${LDFLAGS}" fi @@ -1290,8 +1291,8 @@ AC_CHECK_LIB([z], [deflate], , saved_LDFLAGS="$LDFLAGS" save_LIBS="$LIBS" dnl Check default zlib install dir - if test -n "${need_dash_r}"; then - LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}" + if test -n "${rpath_opt}"; then + LDFLAGS="-L/usr/local/lib ${rpath_opt}/usr/local/lib ${saved_LDFLAGS}" else LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}" fi @@ -1558,8 +1559,8 @@ AC_ARG_WITH([libedit], fi else CPPFLAGS="$CPPFLAGS -I${withval}/include" - if test -n "${need_dash_r}"; then - LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}" + if test -n "${rpath_opt}"; then + LDFLAGS="-L${withval}/lib ${rpath_opt}${withval}/lib ${LDFLAGS}" else LDFLAGS="-L${withval}/lib ${LDFLAGS}" fi @@ -2479,20 +2480,20 @@ AC_ARG_WITH([ssl-dir], ./*|../*) withval="`pwd`/$withval" esac if test -d "$withval/lib"; then - if test -n "${need_dash_r}"; then - LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}" + if test -n "${rpath_opt}"; then + LDFLAGS="-L${withval}/lib ${rpath_opt}${withval}/lib ${LDFLAGS}" else LDFLAGS="-L${withval}/lib ${LDFLAGS}" fi elif test -d "$withval/lib64"; then - if test -n "${need_dash_r}"; then - LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}" + if test -n "${rpath_opt}"; then + LDFLAGS="-L${withval}/lib64 ${rpath_opt}${withval}/lib64 ${LDFLAGS}" else LDFLAGS="-L${withval}/lib64 ${LDFLAGS}" fi else - if test -n "${need_dash_r}"; then - LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}" + if test -n "${rpath_opt}"; then + LDFLAGS="-L${withval} ${rpath_opt}${withval} ${LDFLAGS}" else LDFLAGS="-L${withval} ${LDFLAGS}" fi @@ -4405,8 +4406,8 @@ AC_ARG_WITH([kerberos5], [ CPPFLAGS="$oldCPP" ]) fi - if test ! -z "$need_dash_r" ; then - LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib" + if test -n "${rpath_opt}" ; then + LDFLAGS="$LDFLAGS ${rpath_opt}${KRB5ROOT}/lib" fi if test ! -z "$blibpath" ; then blibpath="$blibpath:${KRB5ROOT}/lib" -- Darren Tucker (dtucker at dtucker.net) GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA (new) Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement.
Gert Doering
2019-Jan-21 07:19 UTC
configure.ac: convert --with-rpath from boolean to argument
Hi, On Mon, Jan 21, 2019 at 09:19:46AM +1100, Darren Tucker wrote:> It might be possible to also roll the somewhat-similar AIX blibpath into > this however the semantics are slightly different and I can't currently > test it so that can be looked at later.If you need something tested on recent AIX versions, just let me know. gert -- "If was one thing all people took for granted, was conviction that if you feed honest figures into a computer, honest figures come out. Never doubted it myself till I met a computer with a sense of humor." Robert A. Heinlein, The Moon is a Harsh Mistress Gert Doering - Munich, Germany gert at greenie.muc.de