Blame m4/socket.m4

Packit 575503
dnl
Packit 575503
dnl socket.m4 --- autoconf input file for gawk
Packit 575503
dnl
Packit 575503
dnl Copyright (C) 1995, 1996, 1998, 1999, 2000, 2003, 2004 the Free Software Foundation, Inc.
Packit 575503
dnl
Packit 575503
dnl This file is part of GAWK, the GNU implementation of the
Packit 575503
dnl AWK Progamming Language.
Packit 575503
dnl
Packit 575503
dnl GAWK is free software; you can redistribute it and/or modify
Packit 575503
dnl it under the terms of the GNU General Public License as published by
Packit 575503
dnl the Free Software Foundation; either version 3 of the License, or
Packit 575503
dnl (at your option) any later version.
Packit 575503
dnl
Packit 575503
dnl GAWK is distributed in the hope that it will be useful,
Packit 575503
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 575503
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 575503
dnl GNU General Public License for more details.
Packit 575503
dnl
Packit 575503
dnl You should have received a copy of the GNU General Public License
Packit 575503
dnl along with this program; if not, write to the Free Software
Packit 575503
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
Packit 575503
dnl
Packit 575503
Packit 575503
dnl Find the socket libraries
Packit 575503
dnl largely stolen from AC_PATH_XTRA
Packit 575503
AC_DEFUN([GAWK_AC_LIB_SOCKETS], [
Packit 575503
gawk_have_sockets=no
Packit 575503
# Check for system-dependent location of socket libraries
Packit 575503
Packit 575503
SOCKET_LIBS=
Packit 575503
if test "$ISC" = yes; then
Packit 575503
  SOCKET_LIBS="-lnsl_s -linet"
Packit 575503
else
Packit 575503
  # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
Packit 575503
  # libraries were built with DECnet support.  And karl@cs.umb.edu says
Packit 575503
  # the Alpha needs dnet_stub (dnet does not exist).
Packit 575503
  #
Packit 575503
  # ADR: Is this needed just for sockets???
Packit 575503
#  AC_CHECK_LIB(dnet, dnet_ntoa, [SOCKET_LIBS="$SOCKET_LIBS -ldnet"])
Packit 575503
#  if test $ac_cv_lib_dnet_ntoa = no; then
Packit 575503
#    AC_CHECK_LIB(dnet_stub, dnet_ntoa,
Packit 575503
#	[SOCKET_LIBS="$SOCKET_LIBS -ldnet_stub"])
Packit 575503
#  fi
Packit 575503
Packit 575503
  # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
Packit 575503
  # to get the SysV transport functions.
Packit 575503
  # chad@anasazi.com says the Pyramid MIS-ES running DC/OSx (SVR4)
Packit 575503
  # needs -lnsl.
Packit 575503
  # The nsl library prevents programs from opening the X display
Packit 575503
  # on Irix 5.2, according to dickey@clark.net.
Packit 575503
  AC_CHECK_FUNC(gethostbyname)
Packit 575503
  if test $ac_cv_func_gethostbyname = no; then
Packit 575503
    AC_CHECK_LIB(nsl, gethostbyname, SOCKET_LIBS="$SOCKET_LIBS -lnsl")
Packit 575503
  fi
Packit 575503
Packit 575503
  # lieder@skyler.mavd.honeywell.com says without -lsocket,
Packit 575503
  # socket/setsockopt and other routines are undefined under SCO ODT
Packit 575503
  # 2.0.  But -lsocket is broken on IRIX 5.2 (and is not necessary
Packit 575503
  # on later versions), says simon@lia.di.epfl.ch: it contains
Packit 575503
  # gethostby* variants that don't use the nameserver (or something).
Packit 575503
  # -lsocket must be given before -lnsl if both are needed.
Packit 575503
  # We assume that if connect needs -lnsl, so does gethostbyname.
Packit 575503
  AC_CHECK_FUNC(connect)
Packit 575503
  if test $ac_cv_func_connect = no; then
Packit 575503
    AC_CHECK_LIB(socket, connect, SOCKET_LIBS="-lsocket $SOCKET_LIBS"
Packit 575503
    				  gawk_have_sockets=yes, ,
Packit 575503
	$SOCKET_LIBS)
Packit 575503
  else
Packit 575503
    gawk_have_sockets=yes
Packit 575503
  fi
Packit 575503
fi
Packit 575503
Packit 575503
if test "${gawk_have_sockets}" = "yes"
Packit 575503
then
Packit 575503
	AC_MSG_CHECKING([where to find the socket library calls])
Packit 575503
	case "${SOCKET_LIBS}" in
Packit 575503
	?*)	gawk_lib_loc="${SOCKET_LIBS}" ;;
Packit 575503
	*)	gawk_lib_loc="the standard library" ;;
Packit 575503
	esac
Packit 575503
	AC_MSG_RESULT([${gawk_lib_loc}])
Packit 575503
Packit 575503
	AC_DEFINE(HAVE_SOCKETS, 1, [we have sockets on this system])
Packit 575503
fi
Packit 575503
AC_SUBST(SOCKET_LIBS)dnl
Packit 575503
])dnl