]> git.pond.sub.org Git - empserver/commitdiff
Check for -lws2_32 properly. The old code relied on $host_os, which
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 4 Mar 2006 06:55:12 +0000 (06:55 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 4 Mar 2006 06:55:12 +0000 (06:55 +0000)
wasn't defined.

src/client/configure.ac

index 463dbb697d9baa8cde50e36bf060840c48fe923d..360674a9e42e821b11db57d31729b30df38f6554 100644 (file)
@@ -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 <winsocks2.h> to work.
+    AC_MSG_CHECKING([for gethostbyname in -lws2_32])
+    save_LIBS=$LIBS
+    LIBS="-lws2_32 $LIBS"
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]],
+                                   [[gethostbyname ("");]])],
+                  [ws2_res=yes], [LIBS=save_LIBS ws2_res=no])
+    AC_MSG_RESULT([$ws2_res])
+fi
 
 ### Checks for header files.