From 0605e10c503e5ed092fab4fa4707cae0acecd17c Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 4 Mar 2006 06:55:12 +0000 Subject: [PATCH] Check for -lws2_32 properly. The old code relied on $host_os, which wasn't defined. --- src/client/configure.ac | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/client/configure.ac b/src/client/configure.ac index 463dbb69..360674a9 100644 --- a/src/client/configure.ac +++ b/src/client/configure.ac @@ -49,14 +49,20 @@ AC_PROG_INSTALL ### Checks for libraries. -LIB_SOCKET_NSL AC_SEARCH_LIBS([setupterm], [termlib termcap]) +LIB_SOCKET_NSL # TODO merge this into LIB_SOCKET_NSL? -case "$host_os" in -*mingw32) - LIBS="-lws2_32 $LIBS" ;; -esac - +if test "$ac_cv_search_gethostbyname" = no; then + dnl Can't search ws2_32 for gethostbyname using AC_SEARCH_LIBS, because + dnl it requires #include to work. + AC_MSG_CHECKING([for gethostbyname in -lws2_32]) + save_LIBS=$LIBS + LIBS="-lws2_32 $LIBS" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[gethostbyname ("");]])], + [ws2_res=yes], [LIBS=save_LIBS ws2_res=no]) + AC_MSG_RESULT([$ws2_res]) +fi ### Checks for header files.