From ca5f8ba1eb077073dd97b3f5043b69dfd07a1633 Mon Sep 17 00:00:00 2001 From: Avuton Olrich Date: Wed, 2 Nov 2011 19:13:21 -0700 Subject: [PATCH] configure.ac: Link to winsock when compiling on win32 --- configure.ac | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index 34a3c37..efb6e22 100644 --- a/configure.ac +++ b/configure.ac @@ -43,24 +43,25 @@ else ncurses=auto fi - -dnl -dnl Check for libraries -dnl - -dnl Try to find the socket functions -AC_CHECK_FUNC([socket], - [], - [AC_CHECK_LIB([socket],[socket],[LIBS="$LIBS -lsocket"], - [AC_MSG_ERROR(No UNIX socket API found)]) - ]) - -dnl Try to find the gethostbyname functions -AC_CHECK_FUNC([gethostbyname], - [], - [AC_CHECK_LIB([nsl],[gethostbyname],[LIBS="$LIBS -lnsl"], - [AC_MSG_ERROR(No UNIX gethostbyname API found)]) - ]) +AC_CANONICAL_HOST + +case "$host_os" in +mingw32* | windows*) + LIBS="$LIBS -lws2_32" + ;; +*) + AC_CHECK_FUNC([socket], + [], + [AC_CHECK_LIB([socket],[socket],[LIBS="$LIBS -lsocket"], + [AC_MSG_ERROR(No UNIX socket API found)]) + ]) + + AC_CHECK_FUNC([gethostbyname], + [], + [AC_CHECK_LIB([nsl],[gethostbyname],[LIBS="$LIBS -lnsl"], + [AC_MSG_ERROR(No UNIX gethostbyname API found)]) + ]) +esac dnl wide character support -- 2.30.2