On Solaris 8, I get this link error: CC -O -L/home/haible/prefix-x86/lib -o test-dirent-c++ test-dirent-c++.o ../gllib/libgnu.a /home/haible/prefix-x86/lib/libintl.so -lc -R/home/haible/prefix-x86/lib -lm -lm -lm -lm -lm -lm Undefined first referenced symbol in file _D_ALLOC_NAMLEN ../gllib/libgnu.a(scandir.o) ld: fatal: Symbol referencing errors. No output written to test-dirent-c++ *** Error code 1
The reason is that scandir.c uses _D_ALLOC_NAMLEN, which is a glibc specific macro. This fixes it: 2010-03-19 Bruno Haible <br...@clisp.org> scandir: Fix link error on Solaris 8. * lib/scandir.c (_D_EXACT_NAMLEN, _D_ALLOC_NAMLEN): New fallback macros. --- lib/scandir.c.orig Sat Mar 20 00:14:04 2010 +++ lib/scandir.c Sat Mar 20 00:09:49 2010 @@ -33,6 +33,13 @@ #undef select +#ifndef _D_EXACT_NAMLEN +# define _D_EXACT_NAMLEN(d) strlen ((d)->d_name) +#endif +#ifndef _D_ALLOC_NAMLEN +# define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN (d) + 1) +#endif + #if _LIBC # ifndef SCANDIR # define SCANDIR scandir