Forcing the use of 'int' version of strerror_r

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

 



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


_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux