git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/6] Only define NEEDS_SOCKET if libsocket is usable

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 17, 2008, 09:16 UTC
Message-ID
<7v63q080io.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<2EA0EACE-D8FE-476A-BAE2-7E12EE961C46@web.de>
Andreas Färber <andreas.faerber@web.de> writes:
Show 19 quoted lines
> diff --git a/configure.ac b/configure.ac
> index 7c2856e..75ec83a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -223,11 +223,11 @@ AC_LINK_IFELSE(ZLIBTEST_SRC,
>  LIBS="$old_LIBS"
>  AC_SUBST(NO_DEFLATE_BOUND)
>  #
> -# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
> +# Define NEEDS_SOCKET if linking with libc is required (SunOS,
>  # Patrick Mauritz).
> -AC_CHECK_LIB([c], [socket],
> -[NEEDS_SOCKET=],
> -[NEEDS_SOCKET=YesPlease])
> +AC_CHECK_LIB([socket], [socket],
> +[NEEDS_SOCKET=YesPlease],
> +[NEEDS_SOCKET=])
>  AC_SUBST(NEEDS_SOCKET)
>  test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"

Doesn't this force linkage with -lsocket even if -lc is enough to use socket(2) calls?

In other words, "checking libc is not enough" is only half correct. The right thing to do is "check libc and if it is sufficient be happy, but otherwise do not automatically assume -lsocket is Ok." Something like:

AC_CHECK_LIB([c], [socket],
[NEEDS_SOCKET=],
[AC_CHECK_LIB([socket], [socket],
        	[NEEDS_SOCKET=YesPlease],
                [NEEDS_SOCKET=])])

Other patches seemed Ok from my cursory look; I do not know the people whose Ack's were on your patch submission, though...

Thanks.
Previous: Andreas FärberNext: Andreas Färber
Message 2 of 3 in “Only define NEEDS_SOCKET if libsocket is usable”
  1. 2/6 Only define NEEDS_SOCKET if libsocket is usableAndreas Färber, Aug 17, 2008
  2. Junio C HamanoAug 17, 2008
  3. Andreas FärberAug 17, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.