At least in libldap and liblber EAGAIN and EWOULDBLOCK are occasionally used without checking whether they are defined or not. Either the checks should be removed, counting on the fact that these error codes are always defined, or they should be used consistently.
I'd say the libldap #ifdefs can safely be removed by now: "cvs annotate" says os-ip.c has had unconditional EWOULDBLOCK since rev 1.34 (Aug 1999), and request.c unconditional EAGAIN since rev 1.85 (Aug 2002). No bug reports since then...
We need to keep the '#if EWOULDBLOCK != EAGAIN's in switches, though.
liblber always #ifdefs them, except in a test program. I suppose these #ifdefs could stay in case someone uses the liblber source stand-alone.
Here's a patch, please inspect.
ftp://ftp.openldap.org/incoming/pierangelo.masarati.2010-11-23.1.patch
p.