Hi Simon, Here are two change requests regarding the 'sockets' module:
1) Currently it adds the library option -lws2_32 to LIBS. But I don't want to link all gettext tools against this libray, just because one program (test-sys_select) needs to link with it. So I propose to introduce a variable, LIBSOCKET, with which programs that use sockets need to link. 2) On Solaris, the test-sys_select program fails to link: /bin/bash ../libtool --tag=CC --preserve-dup-deps --mode=link cc -xarch=v9 -O -g -o test-sys_select test-sys_select.o libtests.a ../gnulib-lib/libgettextlib.la libtests.a libtool: link: cc -xarch=v9 -O -g -o .libs/test-sys_select test-sys_select.o libtests.a ../gnulib-lib/.libs/libgettextlib.so -L/opt/gnu/lib /home/haible/gettext-0.18-pre2-louvre/gettext-tools/intl/.libs/libintl.so -lc -lxml2 /opt/gnu/lib/libiconv.so -ltermcap libtests.a -R/opt/gnu/lib ild: (undefined symbol) bind -- referenced in the text segment of test-sys_select.o ild: (undefined symbol) connect -- referenced in the text segment of test-sys_select.o ild: (undefined symbol) shutdown -- referenced in the text segment of test-sys_select.o ild: (undefined symbol) accept -- referenced in the text segment of test-sys_select.o ild: (undefined symbol) setsockopt -- referenced in the text segment of test-sys_select.o ild: (undefined symbol) listen -- referenced in the text segment of test-sys_select.o ild: (undefined symbol) socket -- referenced in the text segment of test-sys_select.o *** Error code 5 make: Fatal error: Command failed for target `test-sys_select' There are two socket libraries on Solaris: libsocket [1][2] and libxnet [3]. The normal one appears to be libsocket. libxnet depends on libsocket. Therefore I think the right one to use is libsocket. Here is a proposed patch (assuming it passes testing on Solaris and mingw). OK to commit? Bruno [1] http://docs.sun.com/app/docs/doc/816-5173/libsocket-3lib?a=view [2] http://docs.sun.com/app/docs/doc/805-3176/6j31fl7k7?a=view [3] http://docs.sun.com/app/docs/doc/816-5173/libxnet-3lib?a=view 2008-09-28 Bruno Haible <[EMAIL PROTECTED]> * m4/sockets.m4 (gl_SOCKETS): Check also for the need to use -lsocket. Set LIBSOCKET instead of augmenting LIBS. * modules/sockets (Link): New section. * modules/sockets-tests (test_sockets_LDADD): New variable. * modules/sys_select-tests (test_sys_select_LDADD): New variable. * NEWS: Document the change. *** NEWS.orig 2008-09-28 20:36:59.000000000 +0200 --- NEWS 2008-09-28 20:36:55.000000000 +0200 *************** *** 6,11 **** --- 6,14 ---- Date Modules Changes + 2008-09-28 sockets When using this module, you now need to link with + $(LIBSOCKET). + 2008-09-24 sys_select The limitation on `select', introduced 2008-09-23, was removed. sys_select now includes a select wrapper for Winsock. The wrapper expects socket *** m4/sockets.m4.orig 2008-09-28 20:36:59.000000000 +0200 --- m4/sockets.m4 2008-09-28 19:55:30.000000000 +0200 *************** *** 1,4 **** ! # sockets.m4 serial 1 dnl Copyright (C) 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, --- 1,4 ---- ! # sockets.m4 serial 2 dnl Copyright (C) 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, *************** *** 6,31 **** AC_DEFUN([gl_SOCKETS], [ ! AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H ! ! AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32], ! [gl_cv_func_wsastartup], [ ! am_save_LIBS="$LIBS" ! LIBS="$LIBS -lws2_32" ! AC_TRY_LINK([ #ifdef HAVE_WINSOCK2_H # include <winsock2.h> #endif], [ ! WORD wVersionRequested = MAKEWORD(1, 1); ! WSADATA wsaData; ! int err = WSAStartup(wVersionRequested, &wsaData); ! WSACleanup ();], ! gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no) ! LIBS="$am_save_LIBS"]) ! if test "$gl_cv_func_wsastartup" = "yes"; then ! AC_DEFINE([WINDOWS_SOCKETS], 1, [Define if WSAStartup is needed.]) ! LIBS="$LIBS -lws2_32" fi gl_PREREQ_SOCKETS ]) --- 6,53 ---- AC_DEFUN([gl_SOCKETS], [ ! AC_REQUIRE([gl_PREREQ_SYS_H_WINSOCK2])dnl for HAVE_WINSOCK2_H ! LIBSOCKET= ! if test $HAVE_WINSOCK2_H = 1; then ! dnl Native Windows API (not Cygwin). ! AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32], ! [gl_cv_func_wsastartup], [ ! gl_save_LIBS="$LIBS" ! LIBS="$LIBS -lws2_32" ! AC_TRY_LINK([ #ifdef HAVE_WINSOCK2_H # include <winsock2.h> #endif], [ ! WORD wVersionRequested = MAKEWORD(1, 1); ! WSADATA wsaData; ! int err = WSAStartup(wVersionRequested, &wsaData); ! WSACleanup ();], ! gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no) ! LIBS="$gl_save_LIBS" ! ]) ! if test "$gl_cv_func_wsastartup" = "yes"; then ! AC_DEFINE([WINDOWS_SOCKETS], 1, [Define if WSAStartup is needed.]) ! LIBSOCKET='-lws2_32' ! fi ! else ! dnl Unix API. ! dnl Solaris has most socket functions in libsocket. ! AC_CACHE_CHECK([whether setsockopt requires -lsocket], [gl_cv_lib_socket], [ ! gl_cv_lib_socket=no ! AC_TRY_LINK(AC_LANG_EXTERN[char setsockopt();], [setsockopt();], ! [], ! [gl_save_LIBS="$LIBS" ! LIBS="$LIBS -lsocket" ! AC_TRY_LINK(AC_LANG_EXTERN[char setsockopt();], [setsockopt();], ! [gl_cv_lib_socket=yes]) ! LIBS="$gl_save_LIBS" ! ]) ! ]) ! if test $gl_cv_lib_socket = yes; then ! LIBSOCKET='-lsocket' ! fi fi + AC_SUBST([LIBSOCKET]) gl_PREREQ_SOCKETS ]) *** modules/sockets.orig 2008-09-28 20:36:59.000000000 +0200 --- modules/sockets 2008-09-28 19:41:31.000000000 +0200 *************** *** 1,5 **** Description: ! Wrappers for Windows socket functions Files: lib/sockets.c --- 1,5 ---- Description: ! General facilities for using sockets Files: lib/sockets.c *************** *** 18,23 **** --- 18,26 ---- Include: "sockets.h" + Link: + $(LIBSOCKET) + License: LGPL *** modules/sockets-tests.orig 2008-09-28 20:36:59.000000000 +0200 --- modules/sockets-tests 2008-09-28 19:44:26.000000000 +0200 *************** *** 8,10 **** --- 8,11 ---- Makefile.am: TESTS += test-sockets check_PROGRAMS += test-sockets + test_sockets_LDADD = $(LDADD) @LIBSOCKET@ *** modules/sys_select-tests.orig 2008-09-28 20:36:59.000000000 +0200 --- modules/sys_select-tests 2008-09-28 19:43:06.000000000 +0200 *************** *** 16,21 **** --- 16,22 ---- Makefile.am: TESTS += test-sys_select check_PROGRAMS += test-sys_select + test_sys_select_LDADD = $(LDADD) @LIBSOCKET@ License: LGPL