I think you've gone about this in the right way, but need to handle the 
various cases a bit more broadly.  Specifically, you can't assume that 
everyone has strerror() at all (Solaris 8 doesn't, for example) nor that 
everyone who uses int strerror_r() will also define either _XOPEN_SOURCE 
or _POSIX_C_SOURCE (NetBSD doesn't, for example).

I think perhaps a structure like the following might work:

#if defined(HAS_STRERROR_R)
#  if defined(STRERROR_R_RETURNS_INT)
    /* stuff using int strerror_r(); */
#  else
    /* stuff using char *strerror_r() */
#else
    /* stuff using plain strerror(). */
#endif

Currently, you are trying to guess which branch based on various #defines, 
but non-Linux systems will fall through to the wrong branch, and systems 
without strerror_r will fail completely.

Ideally, Configure.pl ought to figure which branch you need. Alas, it 
doesn't.  However, perl5's Configure does (at least for Unix systems), so 
you could just use it's results.

-- 
    Andy Dougherty              [EMAIL PROTECTED]

Reply via email to