annotate m4/servent.m4 @ 17602:f98ee53d8e71

tests: simplify porting to Solaris 10 /bin/sh Some test cases in 'grep' need a shell that groks '$('; export re_shell_ for their benefit. Problem reported for 'grep' by Dagobert Michelsen in <http://bugs.gnu.org/16380>. * tests/init.sh (re_shell_): Export if it's used.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 07 Jan 2014 11:46:27 -0800
parents 344018b6e5d7
children ab58d4870664
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13578
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
1 # servent.m4 serial 2
17587
344018b6e5d7 maint: update copyright
Eric Blake <eblake@redhat.com>
parents: 17249
diff changeset
2 dnl Copyright (C) 2008, 2010-2014 Free Software Foundation, Inc.
10812
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 AC_DEFUN([gl_SERVENT],
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 [
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 dnl Where are getservent(), setservent(), endservent(), getservbyname(),
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 dnl getservbyport() defined?
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 dnl Where are getprotoent(), setprotoent(), endprotoent(), getprotobyname(),
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 dnl getprotobynumber() defined?
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 dnl - On Solaris, they are in libsocket. Ignore libxnet.
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 dnl - On Haiku, they are in libnetwork.
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 dnl - On BeOS, they are in libnet.
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 dnl - On native Windows, they are in ws2_32.dll.
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 dnl - Otherwise they are in libc.
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 SERVENT_LIB=
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 gl_saved_libs="$LIBS"
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 AC_SEARCH_LIBS([getservbyname], [socket network net],
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 [if test "$ac_cv_search_getservbyname" != "none required"; then
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 SERVENT_LIB="$ac_cv_search_getservbyname"
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 fi])
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 LIBS="$gl_saved_libs"
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 if test -z "$SERVENT_LIB"; then
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 AC_CHECK_FUNCS([getservbyname], , [
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 AC_CACHE_CHECK([for getservbyname in winsock2.h and -lws2_32],
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 [gl_cv_w32_getservbyname],
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 [gl_cv_w32_getservbyname=no
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 gl_save_LIBS="$LIBS"
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 LIBS="$LIBS -lws2_32"
13578
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
33 AC_LINK_IFELSE(
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
34 [AC_LANG_PROGRAM(
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
35 [[
10812
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 #ifdef HAVE_WINSOCK2_H
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 #include <winsock2.h>
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 #endif
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 #include <stddef.h>
13578
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
40 ]],
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
41 [[getservbyname(NULL,NULL);]])],
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
42 [gl_cv_w32_getservbyname=yes])
10812
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 LIBS="$gl_save_LIBS"
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 ])
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 if test "$gl_cv_w32_getservbyname" = "yes"; then
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 SERVENT_LIB="-lws2_32"
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 fi
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 ])
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 fi
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 AC_SUBST([SERVENT_LIB])
a672954bb892 New module 'servent'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 ])