Re: [PATCH] configure.ac: rework/fix the NEEDS_RESOLV and NEEDS_LIBGEN tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Brandon Casey <casey@xxxxxxxxxxxxxxx> writes:

> Maybe this is the appropriate thing to do?

Thanks.

Instead of saying that "hstrerror not in -lc means we do have -lresolv and
the function will be found there" blindly, we may want to have a nested
check.

	AC_CHECK_LIB([c], [hstrerror], [NEEDS_RESOLV=],
       	    AC_CHECK_LIB([resolv], [hstrerror], [NEEDS_RESOLV=YesPlease]))

But we do not have any provision for the case where -lc does not have it
and -lresolv does not have it either (or -lresolv does not exist) anyway,
so we might as well go with your patch.

I take it that swapping [if-found][if-not-found] parameters is what the
autoconf documentation warns against?  That is, both -lc and -lresolv may
have it but -lresolv one may be a specialized one you would not normally
want.

>  configure.ac |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 74d0af5..ba44cf2 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -479,13 +479,13 @@ test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
>  # Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
>  # Notably on Solaris hstrerror resides in libresolv and on Solaris 7
>  # inet_ntop and inet_pton additionally reside there.
> -AC_CHECK_LIB([resolv], [hstrerror],
> +AC_CHECK_LIB([c], [hstrerror],
>  [NEEDS_RESOLV=],
>  [NEEDS_RESOLV=YesPlease])
>  AC_SUBST(NEEDS_RESOLV)
>  test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
>  
> -AC_CHECK_LIB([gen], [basename],
> +AC_CHECK_LIB([c], [basename],
>  [NEEDS_LIBGEN=],
>  [NEEDS_LIBGEN=YesPlease])
>  AC_SUBST(NEEDS_LIBGEN)
> -- 
> 1.6.3.1.24.g152f4
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]