1dnl 2dnl socket.m4 --- autoconf input file for gawk 3dnl 4dnl Copyright (C) 1995, 1996, 1998, 1999, 2000, 2003, 2004 the Free Software Foundation, Inc. 5dnl 6dnl This file is part of GAWK, the GNU implementation of the 7dnl AWK Progamming Language. 8dnl 9dnl GAWK is free software; you can redistribute it and/or modify 10dnl it under the terms of the GNU General Public License as published by 11dnl the Free Software Foundation; either version 3 of the License, or 12dnl (at your option) any later version. 13dnl 14dnl GAWK is distributed in the hope that it will be useful, 15dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 16dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17dnl GNU General Public License for more details. 18dnl 19dnl You should have received a copy of the GNU General Public License 20dnl along with this program; if not, write to the Free Software 21dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 22dnl 23 24dnl Find the socket libraries 25dnl largely stolen from AC_PATH_XTRA 26AC_DEFUN([GAWK_AC_LIB_SOCKETS], [ 27gawk_have_sockets=no 28# Check for system-dependent location of socket libraries 29 30SOCKET_LIBS= 31if test "$ISC" = yes; then 32 SOCKET_LIBS="-lnsl_s -linet" 33else 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 71fi 72 73if test "${gawk_have_sockets}" = "yes" 74then 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]) 83fi 84AC_SUBST(SOCKET_LIBS)dnl 85])dnl 86