Skip to content

Commit 5a857c7

Browse files
Gary V. Vaughangitster
authored andcommitted
Make NO_{INET_NTOP,INET_PTON} configured independently
Being careful not to overwrite the results of testing for hstrerror in libresolv, also test whether inet_ntop/inet_pton are available from that library. Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 0a9b167 commit 5a857c7

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

config.mak.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ NO_SETENV=@NO_SETENV@
5353
NO_UNSETENV=@NO_UNSETENV@
5454
NO_MKDTEMP=@NO_MKDTEMP@
5555
NO_MKSTEMPS=@NO_MKSTEMPS@
56+
NO_INET_NTOP=@NO_INET_NTOP@
57+
NO_INET_PTON=@NO_INET_PTON@
5658
NO_ICONV=@NO_ICONV@
5759
OLD_ICONV=@OLD_ICONV@
5860
NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@

configure.ac

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -545,11 +545,33 @@ AC_SUBST(NEEDS_SOCKET)
545545
test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
546546

547547
#
548-
# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
549-
# Notably on Solaris 7 inet_ntop and inet_pton additionally reside there.
550-
AC_CHECK_LIB([c], [inet_ntop],
551-
[NEEDS_RESOLV=],
552-
[NEEDS_RESOLV=YesPlease])
548+
# The next few tests will define NEEDS_RESOLV if linking with
549+
# libresolv provides some of the functions we would normally get
550+
# from libc.
551+
NEEDS_RESOLV=
552+
AC_SUBST(NEEDS_RESOLV)
553+
#
554+
# Define NO_INET_NTOP if linking with -lresolv is not enough.
555+
# Solaris 2.7 in particular hos inet_ntop in -lresolv.
556+
NO_INET_NTOP=
557+
AC_SUBST(NO_INET_NTOP)
558+
AC_CHECK_FUNC([inet_ntop],
559+
[],
560+
[AC_CHECK_LIB([resolv], [inet_ntop],
561+
[NEEDS_RESOLV=YesPlease],
562+
[NO_INET_NTOP=YesPlease])
563+
])
564+
#
565+
# Define NO_INET_PTON if linking with -lresolv is not enough.
566+
# Solaris 2.7 in particular hos inet_pton in -lresolv.
567+
NO_INET_PTON=
568+
AC_SUBST(NO_INET_PTON)
569+
AC_CHECK_FUNC([inet_pton],
570+
[],
571+
[AC_CHECK_LIB([resolv], [inet_pton],
572+
[NEEDS_RESOLV=YesPlease],
573+
[NO_INET_PTON=YesPlease])
574+
])
553575
#
554576
# Define NO_HSTRERROR if linking with -lresolv is not enough.
555577
# Solaris 2.6 in particular has no hstrerror, even in -lresolv.
@@ -561,8 +583,9 @@ AC_CHECK_FUNC([hstrerror],
561583
[NO_HSTRERROR=YesPlease])
562584
])
563585
AC_SUBST(NO_HSTRERROR)
564-
565-
AC_SUBST(NEEDS_RESOLV)
586+
#
587+
# If any of the above tests determined that -lresolv is needed at
588+
# build-time, also set it here for remaining configure-time checks.
566589
test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
567590

568591
AC_CHECK_LIB([c], [basename],

0 commit comments

Comments
 (0)