Code

configure.ac: Link to winsock when compiling on win32
authorAvuton Olrich <avuton@gmail.com>
Thu, 3 Nov 2011 02:13:21 +0000 (19:13 -0700)
committerAvuton Olrich <avuton@gmail.com>
Thu, 3 Nov 2011 02:33:50 +0000 (19:33 -0700)
configure.ac

index 34a3c371243a63d31f9b886577e32bffc5944681..efb6e22bc2944a7627f5cb237a5fdaa0adb142d2 100644 (file)
@@ -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