autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Forcing the use of 'int' version of strerror_r


From: Robert Lowe
Subject: Forcing the use of 'int' version of strerror_r
Date: Wed, 08 Dec 2004 23:34:12 -0600
User-agent: Mozilla Thunderbird 0.8 (X11/20041020)

Hi!

I want to force the use of the POSIX version of strerror_r on systems
that have two versions.  On GNU/Linux, string.h has the following
comment:

/* Reentrant version of `strerror'.
   There are 2 flavors of `strerror_r', GNU which returns the string
   and may or may not use the supplied temporary buffer and POSIX one
   which fills the string into the buffer.
   To use the POSIX version, -D_XOPEN_SOURCE=600 or
   -D_POSIX_C_SOURCE=200112L
   without -D_GNU_SOURCE is needed, otherwise the GNU version is
   preferred.  */

All I can find about the macro is:

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.

I'm not assuming that it would be safe to force -D_XOPEN_SOURCE=600
on all systems, for example, if STRERROR_R_CHAR_P is defined.  What
combination of tests would be recommended?  Only if $GCC is yes, and
STRERROR_R_CHAR_P is defined, or is there a test explicitly for
glibc?  Or something else?  Thanks for your patience... still feeling
a bit like I've gone down a rabbit hole, and there are way more options
at this tea party than I imagined.  ;-)

-Robert




reply via email to

[Prev in Thread] Current Thread [Next in Thread]