Mercurial > hg > octave-lyh > gnulib-hg
changeset 15824:3a4d1597833c
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).
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Tue, 04 Oct 2011 03:33:21 +0200 |
parents | cc69a672efa3 |
children | ab0a4f49f2e8 |
files | ChangeLog NEWS m4/poll.m4 modules/poll modules/poll-h-c++-tests modules/poll-tests |
diffstat | 6 files changed, 47 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +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.
--- a/NEWS +++ b/NEWS @@ -12,6 +12,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.
--- a/m4/poll.m4 +++ b/m4/poll.m4 @@ -1,4 +1,4 @@ -# 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, @@ -7,6 +7,7 @@ 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 @@ -68,6 +69,31 @@ 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.
--- a/modules/poll +++ b/modules/poll @@ -9,6 +9,7 @@ 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] @@ -27,6 +28,9 @@ Include: <poll.h> +Link: +$(LIB_POLL) + License: LGPLv2+