From 7d29d4ba13620ef50c0db6d08508dc41156a3ed7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 10 May 1998 07:40:20 +0000 Subject: [PATCH] look for -lsocket by checking for connect() --- acconfig.h | 1 + configure.in | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/acconfig.h b/acconfig.h index 9fbb13d8..c923a624 100644 --- a/acconfig.h +++ b/acconfig.h @@ -6,3 +6,4 @@ #undef HAVE_UNSIGNED_CHAR #undef HAVE_UTIMBUF #undef ino_t +#undef HAVE_CONNECT diff --git a/configure.in b/configure.in index 7755272a..478ff1aa 100644 --- a/configure.in +++ b/configure.in @@ -85,4 +85,35 @@ AC_TRY_COMPILE([#include echo yes;AC_DEFINE(HAVE_UTIMBUF), echo no) +# If we can't find connect, try looking in -lsocket, -lnsl, and -linet. +# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has +# libsocket.so which has a bad implementation of gethostbyname (it +# only looks in /etc/hosts), so we only look for -lsocket if we need +# it. +AC_CHECK_FUNC(connect, :, +[case "$LIBS" in +*-lnsl*) ;; +*) AC_CHECK_LIB(nsl_s, printf) ;; +esac +case "$LIBS" in +*-lnsl*) ;; +*) AC_CHECK_LIB(nsl, printf) ;; +esac +case "$LIBS" in +*-lsocket*) ;; +*) AC_CHECK_LIB(socket, connect) ;; +esac +case "$LIBS" in +*-linet*) ;; +*) AC_CHECK_LIB(inet, connect) ;; +esac +dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value +dnl has been cached. +if test "$ac_cv_lib_socket_connect" = "yes" || test "$ac_cv_lib_inet_connect" = +"yes"; then + ac_cv_func_connect=yes + AC_DEFINE(HAVE_CONNECT) +fi]) + + AC_OUTPUT(Makefile lib/dummy) -- 2.34.1