All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] autofs: fix libtirpc detection with -Wl,--as-needed
@ 2016-07-06 20:29 Martin von Gagern
  2016-07-08  1:43 ` Ian Kent
  0 siblings, 1 reply; 2+ messages in thread
From: Martin von Gagern @ 2016-07-06 20:29 UTC (permalink / raw)
  To: autofs; +Cc: Martin von Gagern

As reported in https://bugs.gentoo.org/show_bug.cgi?id=588106, the configure
script will fail to detect the presence of libtirpc if -Wl,--as-needed is
included in LDFLAGS.  That is because the check incorrectly includes the
argument -ltircp in the LDFLAGS variable, instead of the LIBS variable where
it belongs.  LIBS comes after the objects so it will be used to satisfy
their dependencies.  LDFLAGS will come before them, causing the library to
be skipped if the --as-needed linker flag is in effect.

Signed-off-by: Martin von Gagern <Martin.vGagern@gmx.net>
---
 aclocal.m4 | 6 +++---
 configure  | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 2115204..fe949a2 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -413,9 +413,9 @@ AC_DEFUN([AF_CHECK_LIBTIRPC],
 [
 # save current flags
 af_check_libtirpc_save_cflags="$CFLAGS"
-af_check_libtirpc_save_ldflags="$LDFLAGS"
+af_check_libtirpc_save_libs="$LIBS"
 CFLAGS="$CFLAGS -I/usr/include/tirpc"
-LDFLAGS="$LDFLAGS -ltirpc"
+LIBS="$LIBS -ltirpc"
 
 AC_TRY_LINK(
     [ #include <rpc/rpc.h> ],
@@ -438,7 +438,7 @@ AC_CHECK_FUNCS([getrpcbyname getservbyname])
 
 # restore flags
 CFLAGS="$af_check_libtirpc_save_cflags"
-LDFLAGS="$af_check_libtirpc_save_ldflags"
+LIBS="$af_check_libtirpc_save_libs"
 ])
 
 AC_DEFUN([AF_WITH_LIBTIRPC],
diff --git a/configure b/configure
index 3e2de6f..3227c71 100755
--- a/configure
+++ b/configure
@@ -3194,9 +3194,9 @@ if test "${with_libtirpc+set}" = set; then :
 
 # save current flags
 af_check_libtirpc_save_cflags="$CFLAGS"
-af_check_libtirpc_save_ldflags="$LDFLAGS"
+af_check_libtirpc_save_libs="$LIBS"
 CFLAGS="$CFLAGS -I/usr/include/tirpc"
-LDFLAGS="$LDFLAGS -ltirpc"
+LIBS="$LIBS -ltirpc"
 
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -3249,7 +3249,7 @@ done
 
 # restore flags
 CFLAGS="$af_check_libtirpc_save_cflags"
-LDFLAGS="$af_check_libtirpc_save_ldflags"
+LIBS="$af_check_libtirpc_save_libs"
 
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-- 
2.9.0

--
To unsubscribe from this list: send the line "unsubscribe autofs" in

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] autofs: fix libtirpc detection with -Wl,--as-needed
  2016-07-06 20:29 [PATCH] autofs: fix libtirpc detection with -Wl,--as-needed Martin von Gagern
@ 2016-07-08  1:43 ` Ian Kent
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Kent @ 2016-07-08  1:43 UTC (permalink / raw)
  To: Martin von Gagern, autofs

On Wed, 2016-07-06 at 22:29 +0200, Martin von Gagern wrote:
> As reported in https://bugs.gentoo.org/show_bug.cgi?id=588106, the configure
> script will fail to detect the presence of libtirpc if -Wl,--as-needed is
> included in LDFLAGS.  That is because the check incorrectly includes the
> argument -ltircp in the LDFLAGS variable, instead of the LIBS variable where
> it belongs.  LIBS comes after the objects so it will be used to satisfy
> their dependencies.  LDFLAGS will come before them, causing the library to
> be skipped if the --as-needed linker flag is in effect.

Thanks for making the effort to send over the patch.

I've added it to my list for the next commit and push, don't know when that will
be though.

While having to use kernel.org majordomo mailing list is not my favourite I
particularly like having a place to put all the individual patches that make up
each release so autofs stays at kernel.org.

TBH I don't much like using github, perhaps one day I'll look into using gitlab.

> 
> Signed-off-by: Martin von Gagern <Martin.vGagern@gmx.net>
> ---
>  aclocal.m4 | 6 +++---
>  configure  | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/aclocal.m4 b/aclocal.m4
> index 2115204..fe949a2 100644
> --- a/aclocal.m4
> +++ b/aclocal.m4
> @@ -413,9 +413,9 @@ AC_DEFUN([AF_CHECK_LIBTIRPC],
>  [
>  # save current flags
>  af_check_libtirpc_save_cflags="$CFLAGS"
> -af_check_libtirpc_save_ldflags="$LDFLAGS"
> +af_check_libtirpc_save_libs="$LIBS"
>  CFLAGS="$CFLAGS -I/usr/include/tirpc"
> -LDFLAGS="$LDFLAGS -ltirpc"
> +LIBS="$LIBS -ltirpc"
>  
>  AC_TRY_LINK(
>      [ #include <rpc/rpc.h> ],
> @@ -438,7 +438,7 @@ AC_CHECK_FUNCS([getrpcbyname getservbyname])
>  
>  # restore flags
>  CFLAGS="$af_check_libtirpc_save_cflags"
> -LDFLAGS="$af_check_libtirpc_save_ldflags"
> +LIBS="$af_check_libtirpc_save_libs"
>  ])
>  
>  AC_DEFUN([AF_WITH_LIBTIRPC],
> diff --git a/configure b/configure
> index 3e2de6f..3227c71 100755
> --- a/configure
> +++ b/configure
> @@ -3194,9 +3194,9 @@ if test "${with_libtirpc+set}" = set; then :
>  
>  # save current flags
>  af_check_libtirpc_save_cflags="$CFLAGS"
> -af_check_libtirpc_save_ldflags="$LDFLAGS"
> +af_check_libtirpc_save_libs="$LIBS"
>  CFLAGS="$CFLAGS -I/usr/include/tirpc"
> -LDFLAGS="$LDFLAGS -ltirpc"
> +LIBS="$LIBS -ltirpc"
>  
>  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
>  /* end confdefs.h.  */
> @@ -3249,7 +3249,7 @@ done
>  
>  # restore flags
>  CFLAGS="$af_check_libtirpc_save_cflags"
> -LDFLAGS="$af_check_libtirpc_save_ldflags"
> +LIBS="$af_check_libtirpc_save_libs"
>  
>  else
>    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--
To unsubscribe from this list: send the line "unsubscribe autofs" in

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-08  1:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-06 20:29 [PATCH] autofs: fix libtirpc detection with -Wl,--as-needed Martin von Gagern
2016-07-08  1:43 ` Ian Kent

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.