* m4/poll.m4 (gl_FUNC_POLL): Determine LIB_POLL.
* modules/poll (Depends-on): Add sockets.
(Link): New section.
* NEWS: Mention the change.
* modules/poll-tests (Makefile.am): Link test-poll against $(LIB_POLL).
* modules/poll-h-c++-tests (Makefile.am): Link test-poll-h-c++ against
$(LIB_POLL) instead of $(LIBSOCKET).
+2011-10-03 Bruno Haible <bruno@clisp.org>
+
+ poll: Avoid link errors on MSVC.
+ * m4/poll.m4 (gl_FUNC_POLL): Determine LIB_POLL.
+ * modules/poll (Depends-on): Add sockets.
+ (Link): New section.
+ * NEWS: Mention the change.
+ * modules/poll-tests (Makefile.am): Link test-poll against $(LIB_POLL).
+ * modules/poll-h-c++-tests (Makefile.am): Link test-poll-h-c++ against
+ $(LIB_POLL) instead of $(LIBSOCKET).
+
2011-10-03 Bruno Haible <bruno@clisp.org>
sys_select tests: Fix link error on MSVC 9.
Date Modules Changes
+2011-10-03 poll The link requirements of this module are changed
+ from empty to $(LIB_POLL).
+
2011-09-25 sys_stat This module no longer provides the fstat()
function. If you need this function, you now need
to request the 'fstat' module.
-# poll.m4 serial 14
+# poll.m4 serial 15
dnl Copyright (c) 2003, 2005-2007, 2009-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_DEFUN([gl_FUNC_POLL],
[
AC_REQUIRE([gl_POLL_H])
+ AC_REQUIRE([gl_SOCKETS])
if test "$ac_cv_header_poll_h" = no; then
ac_cv_func_poll=no
gl_cv_func_poll=no
AC_DEFINE([HAVE_POLL], [1],
[Define to 1 if you have the 'poll' function and it works.])
fi
+
+ dnl Determine the needed libraries.
+ LIB_POLL="$LIBSOCKET"
+ if test $HAVE_POLL = 0 || test $REPLACE_POLL = 1; then
+ case "$host_os" in
+ mingw*)
+ dnl On the MSVC platform, the function MsgWaitForMultipleObjects
+ dnl (used in lib/poll.c) requires linking with -luser32. On mingw,
+ dnl it is implicit.
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([[
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+int
+main ()
+{
+ MsgWaitForMultipleObjects (0, NULL, 0, 0, 0);
+ return 0;
+}]])],
+ [],
+ [LIB_POLL="$LIB_POLL -luser32"])
+ ;;
+ esac
+ fi
+ AC_SUBST([LIB_POLL])
])
# Prerequisites of lib/poll.c.
poll-h
alloca [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
select [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
+sockets [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
sys_select [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
sys_time [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
errno [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
Include:
<poll.h>
+Link:
+$(LIB_POLL)
+
License:
LGPLv2+
TESTS += test-poll-h-c++
check_PROGRAMS += test-poll-h-c++
test_poll_h_c___SOURCES = test-poll-h-c++.cc
-test_poll_h_c___LDADD = $(LDADD) @LIBSOCKET@
+test_poll_h_c___LDADD = $(LDADD) $(LIB_POLL)
endif
Makefile.am:
TESTS += test-poll
check_PROGRAMS += test-poll
-test_poll_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB)
+test_poll_LDADD = $(LDADD) $(LIB_POLL) @LIBSOCKET@ $(INET_PTON_LIB)