Skip to content

Commit de21eda

Browse files
committed
Retire all remaining IRIX and SINIX support. [skip appveyor]
AC_LBL_LIBRARY_NET in tcpdump is out of date, study the current requirements and copy from libpcap only what is really necessary. This works as expected, for example: Linux, NetBSD and Solaris 11.4: checking for gethostbyaddr... yes illumos: checking for gethostbyaddr... no checking for gethostbyaddr in -lsocket... yes Haiku: checking for gethostbyaddr... no checking for gethostbyaddr in -lsocket... no checking for gethostbyaddr in -lnetwork... yes
1 parent 8482d8c commit de21eda

File tree

2 files changed

+18
-49
lines changed

2 files changed

+18
-49
lines changed

aclocal.m4

Lines changed: 17 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -783,55 +783,24 @@ AC_DEFUN(AC_LBL_DEVEL,
783783
fi])
784784

785785
dnl
786-
dnl AC_LBL_LIBRARY_NET
787-
dnl
788-
dnl This test is for network applications that need socket() and
789-
dnl gethostbyaddr() -ish functions. Under Solaris, those applications
790-
dnl need to link with "-lsocket -lnsl". Under IRIX, they need to link
791-
dnl with "-lnsl" but should *not* link with "-lsocket" because
792-
dnl libsocket.a breaks a number of things (for instance:
793-
dnl gethostbyaddr() under IRIX 5.2, and snoop sockets under most
794-
dnl versions of IRIX).
795-
dnl
796-
dnl Unfortunately, many application developers are not aware of this,
797-
dnl and mistakenly write tests that cause -lsocket to be used under
798-
dnl IRIX. It is also easy to write tests that cause -lnsl to be used
799-
dnl under operating systems where neither are necessary (or useful),
800-
dnl such as SunOS 4.1.4, which uses -lnsl for TLI.
801-
dnl
802-
dnl This test exists so that every application developer does not test
803-
dnl this in a different, and subtly broken fashion.
804-
805-
dnl It has been argued that this test should be broken up into two
806-
dnl separate tests, one for the resolver libraries, and one for the
807-
dnl libraries necessary for using Sockets API. Unfortunately, the two
808-
dnl are carefully intertwined and allowing the autoconf user to use
809-
dnl them independently potentially results in unfortunate ordering
810-
dnl dependencies -- as such, such component macros would have to
811-
dnl carefully use indirection and be aware if the other components were
812-
dnl executed. Since other autoconf macros do not go to this trouble,
813-
dnl and almost no applications use sockets without the resolver, this
814-
dnl complexity has not been implemented.
815-
dnl
816-
dnl The check for libresolv is in case you are attempting to link
817-
dnl statically and happen to have a libresolv.a lying around (and no
818-
dnl libnsl.a).
786+
dnl This is a simplified adaptation of AC_LBL_LIBRARY_NET from libpcap.
787+
dnl In this context tcpdump needs gethostbyaddr() only.
819788
dnl
820789
AC_DEFUN(AC_LBL_LIBRARY_NET, [
821-
# Most operating systems have gethostbyaddr() in the default searched
822-
# libraries (i.e. libc):
823-
# Some OSes (eg. Solaris) place it in libnsl
824-
# Some strange OSes (SINIX) have it in libsocket:
825-
AC_SEARCH_LIBS(gethostbyaddr, network nsl socket resolv)
826-
# Unfortunately libsocket sometimes depends on libnsl and
827-
# AC_SEARCH_LIBS isn't up to the task of handling dependencies like this.
828-
if test "$ac_cv_search_gethostbyaddr" = "no"
829-
then
790+
AC_CHECK_FUNC(gethostbyaddr,,
791+
[
830792
AC_CHECK_LIB(socket, gethostbyaddr,
831-
LIBS="-lsocket -lnsl $LIBS", , -lnsl)
832-
fi
833-
AC_SEARCH_LIBS(socket, socket, ,
834-
AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl))
835-
# DLPI needs putmsg under HPUX so test for -lstr while we're at it
836-
AC_SEARCH_LIBS(putmsg, str)
793+
[
794+
LIBS="-lsocket -lnsl $LIBS"
795+
],
796+
[
797+
AC_CHECK_LIB(network, gethostbyaddr,
798+
[
799+
LIBS="-lnetwork $LIBS"
800+
],
801+
[
802+
AC_MSG_ERROR([gethostbyaddr is required, but wasn't found])
803+
])
804+
], -lnsl)
837805
])
806+
])

nameser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191

9292
/*
9393
* Undefine various #defines from various System V-flavored OSes (Solaris,
94-
* SINIX, HP-UX) so the compiler doesn't whine that we redefine them.
94+
* HP-UX) so the compiler doesn't whine that we redefine them.
9595
*/
9696
#ifdef T_NULL
9797
#undef T_NULL

0 commit comments

Comments
 (0)