3 dnl Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7 dnl This file is offered as-is, without any warranty.
11 dnl Where are getservent(), setservent(), endservent(), getservbyname(),
12 dnl getservbyport() defined?
13 dnl Where are getprotoent(), setprotoent(), endprotoent(), getprotobyname(),
14 dnl getprotobynumber() defined?
15 dnl - On Solaris < 11.4, they are in libsocket. Ignore libxnet.
16 dnl - On Haiku, they are in libnetwork.
17 dnl - On BeOS, they are in libnet.
18 dnl - On native Windows, they are in ws2_32.dll.
19 dnl - Otherwise they are in libc.
20 AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
23 AC_SEARCH_LIBS([getservbyname], [socket network net],
24 [if test "$ac_cv_search_getservbyname" != "none required"; then
25 SERVENT_LIB="$ac_cv_search_getservbyname"
28 if test -z "$SERVENT_LIB"; then
29 AC_CHECK_FUNCS([getservbyname], , [
30 AC_CACHE_CHECK([for getservbyname in winsock2.h and -lws2_32],
31 [gl_cv_w32_getservbyname],
32 [gl_cv_w32_getservbyname=no
38 #ifdef HAVE_WINSOCK2_H
43 [[getservbyname(NULL,NULL);]])],
44 [gl_cv_w32_getservbyname=yes])
47 if test "$gl_cv_w32_getservbyname" = "yes"; then
48 SERVENT_LIB="-lws2_32"
52 AC_SUBST([SERVENT_LIB])