Re: [PATCH] configure.ac: rework/fix the NEEDS_RESOLV and NEEDS_LIBGEN tests
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 21, 2009, 20:33 UTC
- Message-ID
- <7v3a8pdbdr.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <N0R1rELOlDFDG8pOY2LYJHmWygM5WFD8q_fNZgfE1A2QOX1yg6OPCZW4RbX5i03hokq4Bx2zOjM@cipher.nrlssc.navy.mil>
Brandon Casey <casey@nrlssc.navy.mil> 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.
Show 25 quoted lines
> 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