Am 02.11.2012 um 11:13 schrieb Richard Frith-Macdonald:

> So how do we test for it?
> The point is not whether or not we need this behavior but how to control it 
> ... there's a simple ifdef required in one header ... what we are lacking is 
> the knowledge of how we can best determine when we need it defined and when 
> we don't.
> Probably what's needed is some autoconf magic so that the configure script 
> can detemine what needs doing and then common.h could use an autoconf 
> generated value from config.h to decide what to do.
> ... any contribtion here welcome (I'm not great at autoconf).

I was going about to write the test, but then I found that autoconf already has 
a predefined test for it (obviously, we are not the only ones struggling with 
this dichotomy :-)

 -- Macro: AC_FUNC_STRERROR_R
     If `strerror_r' is available, define `HAVE_STRERROR_R', and if it
     is declared, define `HAVE_DECL_STRERROR_R'.  If it returns a `char
     *' message, define `STRERROR_R_CHAR_P'; otherwise it returns an
     `int' error number.  The Thread-Safe Functions option of Posix
     requires `strerror_r' to return `int', but many systems
     (including, for example, version 2.2.4 of the GNU C Library)
     return a `char *' value that is not necessarily equal to the
     buffer argument.

So instead of using
 AC_CHECK_FUNCS(strerror_r strerror)
in configure.ac, we should be using
 AC_CHECK_FUNCS(strerror)
 AC_FUNC_STRERROR_R
and add STRERROR_R_CHAR_P to config.h.in and use it to select a suitable 
variant of the code in the _systemError: method.

Wolfgang
 
_______________________________________________
Gnustep-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to