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>
Gary V. Vaughan committed
May 14, 2010 at 09:31 UTC
5a857c74baa96c4b20cdf9cab83a77972e6560de
2 files changed
+32
-7
config.mak.in
+2
@@ -53,6 +53,8 @@ NO_SETENV=@NO_SETENV@
53
NO_UNSETENV=@NO_UNSETENV@
54
NO_MKDTEMP=@NO_MKDTEMP@
55
NO_MKSTEMPS=@NO_MKSTEMPS@
56
+NO_INET_NTOP=@NO_INET_NTOP@
57
+NO_INET_PTON=@NO_INET_PTON@
58
NO_ICONV=@NO_ICONV@
59
OLD_ICONV=@OLD_ICONV@
60
NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
configure.ac
+30
-7
@@ -545,11 +545,33 @@ AC_SUBST(NEEDS_SOCKET)
545
test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
546
547
#
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
+])
575
#
576
# Define NO_HSTRERROR if linking with -lresolv is not enough.
577
# Solaris 2.6 in particular has no hstrerror, even in -lresolv.
@@ -561,8 +583,9 @@ AC_CHECK_FUNC([hstrerror],
583
[NO_HSTRERROR=YesPlease])
584
])
585
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.
589
test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
590
591
AC_CHECK_LIB([c], [basename],