Bruno Haible <[EMAIL PROTECTED]> writes: > Simon Josefsson wrote: >> The current situation breaks simple test-cases like this: >> >> rm -rf m;gnulib-tool --create-testdir --with-tests --dir m poll; cd m; >> ./configure --host=i586-mingw32msvc --build=i686-pc-linux-gnu; make check; >> cd .. >> >> Regardless of the solution, I think the above command should work. > > The above command does work.
No, it fails with latest gnulib master: i586-mingw32msvc-gcc -g -O2 -o test-perror.exe test-perror.o ../gllib/libgnu.a i586-mingw32msvc-gcc -DHAVE_CONFIG_H -I. -I. -I. -I.. -I./.. -I../gllib -I./../gllib -g -O2 -MT test-poll.o -MD -MP -MF .deps/test-poll.Tpo -c -o test-poll.o test-poll.c test-poll.c:31:23: error: sys/ioctl.h: No such file or directory make[3]: *** [test-poll.o] Error 1 make[3]: Leaving directory `/home/jas/src/gnulib/m/gltests' make[2]: *** [check-recursive] Error 1 make[2]: Leaving directory `/home/jas/src/gnulib/m/gltests' make[1]: *** [check] Error 2 make[1]: Leaving directory `/home/jas/src/gnulib/m/gltests' make: *** [check-recursive] Error 1 [EMAIL PROTECTED]:~/src/gnulib master$ However, I now realize this is a different problem than when --import is used. It seems that dependencies of test modules aren't respected by --create-testdir --with-tests, there is no sys_ioctl.in.h file: [EMAIL PROTECTED]:~/src/gnulib master$ find m |grep ioct m/glm4/sys_ioctl_h.m4 [EMAIL PROTECTED]:~/src/gnulib master$ >> The problem is caused by: >> >> 1) One gnulib module (e.g., shutdown) pulls in one file (winsock.c) in >> the gl/ directory >> >> 2) A test module (e.g., poll-tests) depends on a module (e.g., ioctl) >> that change how winsock.c behaves (i.e., causes it to #include >> additional headers such as sys/ioctl.h) >> >> I guess this happens whenever you re-use the same *.c file for more than >> one module > > Correct. The aforementioned move of files from lib/ to tests/ assumes that > every source file is compiled only for one module. > > I think what gnulib-tool does is basically right, and it's not worth the > effort to make gnulib-tool understand which files may be compilation units > in which modules. Rather, I see two solutions, that both introduce separate > compilation units for each sockets module: > > a) Rename winsock.c to w32sock.h. > Create a file connect.c containing > > #define GNULIB_CONNECT 1 > #include "w32sock.h" > > and similarly for the other modules that make up winsock.c. > > Remove the gl_MODULE_INDICATOR([$1]) line from the definition of > gl_SYS_SOCKET_MODULE_INDICATOR. > > b) Split winsock.c into accept.c, connect.c, etc. - like we are doing > in gnulib for most other functionalities. The inline functions > (FD_TO_SOCKET, SOCKET_TO_FD, set_winsock_errno) can go to a private > header file, let's say, w32sock.h or socket-internal.h. > > I would prefer b), because it's leads to a more understandable code structure. I don't care strongly, but b) seems easier to understand so I would prefer it too. Since Paolo didn't object to either proposal, I am preparing patches to implement b) now. Will push and e-mail them separately. /Simon