1 | dnl
|
---|
2 | dnl socket.m4 --- autoconf input file for gawk
|
---|
3 | dnl
|
---|
4 | dnl Copyright (C) 1995, 1996, 1998, 1999, 2000, 2003, 2004 the Free Software Foundation, Inc.
|
---|
5 | dnl
|
---|
6 | dnl This file is part of GAWK, the GNU implementation of the
|
---|
7 | dnl AWK Progamming Language.
|
---|
8 | dnl
|
---|
9 | dnl GAWK is free software; you can redistribute it and/or modify
|
---|
10 | dnl it under the terms of the GNU General Public License as published by
|
---|
11 | dnl the Free Software Foundation; either version 2 of the License, or
|
---|
12 | dnl (at your option) any later version.
|
---|
13 | dnl
|
---|
14 | dnl GAWK is distributed in the hope that it will be useful,
|
---|
15 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
16 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
17 | dnl GNU General Public License for more details.
|
---|
18 | dnl
|
---|
19 | dnl You should have received a copy of the GNU General Public License
|
---|
20 | dnl along with this program; if not, write to the Free Software
|
---|
21 | dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
22 | dnl
|
---|
23 |
|
---|
24 | dnl Find the socket libraries
|
---|
25 | dnl largely stolen from AC_PATH_XTRA
|
---|
26 | AC_DEFUN([GAWK_AC_LIB_SOCKETS], [
|
---|
27 | gawk_have_sockets=no
|
---|
28 | # Check for system-dependent location of socket libraries
|
---|
29 |
|
---|
30 | SOCKET_LIBS=
|
---|
31 | if test "$ISC" = yes; then
|
---|
32 | SOCKET_LIBS="-lnsl_s -linet"
|
---|
33 | else
|
---|
34 | # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
|
---|
35 | # libraries were built with DECnet support. And karl@cs.umb.edu says
|
---|
36 | # the Alpha needs dnet_stub (dnet does not exist).
|
---|
37 | #
|
---|
38 | # ADR: Is this needed just for sockets???
|
---|
39 | # AC_CHECK_LIB(dnet, dnet_ntoa, [SOCKET_LIBS="$SOCKET_LIBS -ldnet"])
|
---|
40 | # if test $ac_cv_lib_dnet_ntoa = no; then
|
---|
41 | # AC_CHECK_LIB(dnet_stub, dnet_ntoa,
|
---|
42 | # [SOCKET_LIBS="$SOCKET_LIBS -ldnet_stub"])
|
---|
43 | # fi
|
---|
44 |
|
---|
45 | # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
|
---|
46 | # to get the SysV transport functions.
|
---|
47 | # chad@anasazi.com says the Pyramid MIS-ES running DC/OSx (SVR4)
|
---|
48 | # needs -lnsl.
|
---|
49 | # The nsl library prevents programs from opening the X display
|
---|
50 | # on Irix 5.2, according to dickey@clark.net.
|
---|
51 | AC_CHECK_FUNC(gethostbyname)
|
---|
52 | if test $ac_cv_func_gethostbyname = no; then
|
---|
53 | AC_CHECK_LIB(nsl, gethostbyname, SOCKET_LIBS="$SOCKET_LIBS -lnsl")
|
---|
54 | fi
|
---|
55 |
|
---|
56 | # lieder@skyler.mavd.honeywell.com says without -lsocket,
|
---|
57 | # socket/setsockopt and other routines are undefined under SCO ODT
|
---|
58 | # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary
|
---|
59 | # on later versions), says simon@lia.di.epfl.ch: it contains
|
---|
60 | # gethostby* variants that don't use the nameserver (or something).
|
---|
61 | # -lsocket must be given before -lnsl if both are needed.
|
---|
62 | # We assume that if connect needs -lnsl, so does gethostbyname.
|
---|
63 | AC_CHECK_FUNC(connect)
|
---|
64 | if test $ac_cv_func_connect = no; then
|
---|
65 | AC_CHECK_LIB(socket, connect, SOCKET_LIBS="-lsocket $SOCKET_LIBS"
|
---|
66 | gawk_have_sockets=yes, ,
|
---|
67 | $SOCKET_LIBS)
|
---|
68 | else
|
---|
69 | gawk_have_sockets=yes
|
---|
70 | fi
|
---|
71 | fi
|
---|
72 |
|
---|
73 | if test "${gawk_have_sockets}" = "yes"
|
---|
74 | then
|
---|
75 | AC_MSG_CHECKING([where to find the socket library calls])
|
---|
76 | case "${SOCKET_LIBS}" in
|
---|
77 | ?*) gawk_lib_loc="${SOCKET_LIBS}" ;;
|
---|
78 | *) gawk_lib_loc="the standard library" ;;
|
---|
79 | esac
|
---|
80 | AC_MSG_RESULT([${gawk_lib_loc}])
|
---|
81 |
|
---|
82 | AC_DEFINE(HAVE_SOCKETS, 1, [we have sockets on this system])
|
---|
83 | fi
|
---|
84 | AC_SUBST(SOCKET_LIBS)dnl
|
---|
85 | ])dnl
|
---|