From: Avuton Olrich Date: Thu, 3 Nov 2011 02:13:21 +0000 (-0700) Subject: configure.ac: Link to winsock when compiling on win32 X-Git-Tag: release-0.20~69 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ca5f8ba1eb077073dd97b3f5043b69dfd07a1633;p=ncmpc.git configure.ac: Link to winsock when compiling on win32 --- 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