On Cygwin, the dirent test fails to link for me: gcc -std=gnu99 -g -O2 -L/usr/local/cygwin/lib -Wl,--as-needed -o test-dirent-safer.exe test-dirent-safer.o ../gllib/libgnu.a ../gllib/libgnu.a(openat-die.o): In function `openat_save_fail': /home/bruno/testdir4/gllib/openat-die.c:33: undefined reference to `_libintl_gettext' ../gllib/libgnu.a(openat-die.o): In function `openat_restore_fail': /home/bruno/testdir4/gllib/openat-die.c:51: undefined reference to `_libintl_gettext' ../gllib/libgnu.a(error.o): In function `error_tail': /home/bruno/testdir4/gllib/error.c:153: undefined reference to `_libintl_gettext' ../gllib/libgnu.a(xalloc-die.o): In function `xalloc_die': /home/bruno/testdir4/gllib/xalloc-die.c:34: undefined reference to `_libintl_gettext' collect2: ld returned 1 exit status make[4]: *** [test-dirent-safer.exe] Error 1
The reason is an optional dependency dirent-safer -> fdopendir and a sequence of dependencies fdopendir -> save_cwd -> xgetcwd -> xalloc-die -> gettext-h I'm applying this fix: 2010-03-07 Bruno Haible <[email protected]> Fix test-dirent-safer link error. * modules/dirent-safer-tests (Makefile.am): Define test_dirent_safer_LDADD. --- modules/dirent-safer-tests.orig Sun Mar 7 23:24:59 2010 +++ modules/dirent-safer-tests Sun Mar 7 23:23:47 2010 @@ -10,3 +10,6 @@ Makefile.am: TESTS += test-dirent-safer check_PROGRAMS += test-dirent-safer +# Link with libintl when needed. dirent-safer uses fdopendir if it is present, +# and fdopendir indirectly depends on xgetcwd -> xalloc-die -> gettext-h. +test_dirent_safer_LDADD = $(LDADD) $(LIBINTL)
