autofs-5.1.2 - fix libtirpc detection with -Wl,--as-needed From: 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 Signed-off-by: Ian Kent --- CHANGELOG | 1 + aclocal.m4 | 6 +++--- configure | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index cb895c4..9291c20 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,7 @@ xx/xx/2016 autofs-5.1.3 - fix compiler warning in try_remount(). - drop redundant \n in logerr(). - Fix size arg of fgets(3). +- fix libtirpc detection with -Wl,--as-needed. 15/06/2016 autofs-5.1.2 ======================= 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 ], @@ -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 6ae1f97..5a05fe1 100755 --- a/configure +++ b/configure @@ -3195,9 +3195,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. */ @@ -3250,7 +3250,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