On 08/07/2014 06:59 PM, Paul Eggert wrote: > That shouldn't be a problem, since the modules in question all depend on > the getdtablesize module, which should supply the getdtablesize function > on platforms that lack it.
Ah. I missed that. Some background: I'm porting these modules (as found in bison, gettext, m4, and such) to a new operating system. It has the standard sysconf(_SC_OPEN_MAX) interface and it doesn't have the older and non-standard getdtablesize() interface. But the gnulib getdtablesize only has implementations for Windows and Cygwin. This causes an undefined reference error when the spawn faction modules tries to use it. We can fix this: 1) Add a getdtablesize () replacement based on sysconf (_SC_OPEN_MAX). 2) Replace __sysconf (_SC_OPEN_MAX) with getdtablesize (). The modules shouldn't use the __sysconf name as it is in the reserved namespace and actually likely to collide with a system header. It should just call getdtablesize directly. I'm proposing something like this: lib/getdtablesize.c +#elif HAVE_SYSCONF + +int +getdtablesize (void) +{ + return sysconf (_SC_OPEN_MAX); +} + +#endif lib/spawn_faction_addfoo.c -#if !_LIBC -# define __sysconf(open_max) getdtablesize () -#endif ... - int maxfd = __sysconf (_SC_OPEN_MAX); + int maxfd = getdtablesize (); Thanks, Jonas