diff options
author | Bruno Haible <bruno@clisp.org> | 2011-09-22 23:45:06 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2011-09-22 23:45:06 +0200 |
commit | d7255651d7f2040807a6dc32df6363a60f2c69c6 (patch) | |
tree | 29fb4e5ae423ca29afad63d5b923d6307fa111bd | |
parent | 9db21df32bfd7af0ddc7bad2eda5050a1e96743f (diff) | |
download | gnulib-d7255651d7f2040807a6dc32df6363a60f2c69c6.tar.gz |
select: Avoid link errors on MSVC.
* m4/select.m4 (gl_FUNC_SELECT): Determine LIB_SELECT.
* modules/select (Link): Replace $(LIBSOCKET) with $(LIB_SELECT).
* modules/pselect (Link): Likewise.
* NEWS: Mention the change.
* modules/select-tests (Makefile.am): Link test-select, test-select-fd,
test-select-stdin against $(LIB_SELECT).
* modules/pselect-tests (Makefile.am): Link test-pselect against
$(LIB_SELECT).
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | m4/select.m4 | 27 | ||||
-rw-r--r-- | modules/pselect | 2 | ||||
-rw-r--r-- | modules/pselect-tests | 2 | ||||
-rw-r--r-- | modules/select | 2 | ||||
-rw-r--r-- | modules/select-tests | 6 |
7 files changed, 47 insertions, 7 deletions
@@ -1,5 +1,17 @@ 2011-09-22 Bruno Haible <bruno@clisp.org> + select: Avoid link errors on MSVC. + * m4/select.m4 (gl_FUNC_SELECT): Determine LIB_SELECT. + * modules/select (Link): Replace $(LIBSOCKET) with $(LIB_SELECT). + * modules/pselect (Link): Likewise. + * NEWS: Mention the change. + * modules/select-tests (Makefile.am): Link test-select, test-select-fd, + test-select-stdin against $(LIB_SELECT). + * modules/pselect-tests (Makefile.am): Link test-pselect against + $(LIB_SELECT). + +2011-09-22 Bruno Haible <bruno@clisp.org> + select: Avoid compilation error on MSVC. * lib/select.c: Don't include <stdbool.h>. @@ -12,6 +12,9 @@ User visible incompatible changes Date Modules Changes +2011-09-22 select The link requirements of this module are changed + from $(LIBSOCKET) to $(LIB_SELECT). + 2011-09-12 fchdir This module no longer overrides the functions opendir() and closedir(), unless the modules 'opendir' and 'closedir' are in use, respectively. diff --git a/m4/select.m4 b/m4/select.m4 index d9c3465b12..a58f0ac3a1 100644 --- a/m4/select.m4 +++ b/m4/select.m4 @@ -1,4 +1,4 @@ -# select.m4 serial 5 +# select.m4 serial 6 dnl Copyright (C) 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, @@ -47,4 +47,29 @@ changequote([,])dnl *) REPLACE_SELECT=1 ;; esac fi + + dnl Determine the needed libraries. + LIB_SELECT="$LIBSOCKET" + if test $REPLACE_SELECT = 1; then + case "$host_os" in + mingw*) + dnl On the MSVC platform, the function MsgWaitForMultipleObjects + dnl (used in lib/select.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_SELECT="$LIB_SELECT -luser32"]) + ;; + esac + fi + AC_SUBST([LIB_SELECT]) ]) diff --git a/modules/pselect b/modules/pselect index fa69c5369b..1ca08edea9 100644 --- a/modules/pselect +++ b/modules/pselect @@ -23,7 +23,7 @@ Include: <sys/select.h> Link: -$(LIBSOCKET) $(LIB_PTHREAD_SIGMASK) +$(LIB_SELECT) $(LIB_PTHREAD_SIGMASK) License: LGPLv2+ diff --git a/modules/pselect-tests b/modules/pselect-tests index 0dccb3634d..0c37ff6abf 100644 --- a/modules/pselect-tests +++ b/modules/pselect-tests @@ -30,4 +30,4 @@ AC_CHECK_HEADERS_ONCE([sys/wait.h]) Makefile.am: TESTS += test-pselect check_PROGRAMS += test-pselect -test_pselect_LDADD = $(LDADD) @LIBSOCKET@ @LIB_PTHREAD_SIGMASK@ $(INET_PTON_LIB) +test_pselect_LDADD = $(LDADD) @LIB_SELECT@ @LIBSOCKET@ @LIB_PTHREAD_SIGMASK@ $(INET_PTON_LIB) diff --git a/modules/select b/modules/select index 5969a4eaf2..f665740b03 100644 --- a/modules/select +++ b/modules/select @@ -23,7 +23,7 @@ Include: <sys/select.h> Link: -$(LIBSOCKET) +$(LIB_SELECT) License: LGPLv2+ diff --git a/modules/select-tests b/modules/select-tests index a3b13db2d5..bd7b731371 100644 --- a/modules/select-tests +++ b/modules/select-tests @@ -36,6 +36,6 @@ Makefile.am: TESTS += test-select test-select-in.sh test-select-out.sh # test-select-stdin has to be run by hand. check_PROGRAMS += test-select test-select-fd test-select-stdin -test_select_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB) -test_select_fd_LDADD = $(LDADD) @LIBSOCKET@ -test_select_stdin_LDADD = $(LDADD) @LIBSOCKET@ +test_select_LDADD = $(LDADD) @LIB_SELECT@ @LIBSOCKET@ $(INET_PTON_LIB) +test_select_fd_LDADD = $(LDADD) @LIB_SELECT@ +test_select_stdin_LDADD = $(LDADD) @LIB_SELECT@ |