Use dedicated code for glibc specific variant of strerror_r based on

an autoconf test instead of trying to tweak feature test macros to use
the POSIX version.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35774 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2012-11-02 13:44:30 +00:00
parent 710f96dbb6
commit c67e228f86
8 changed files with 5443 additions and 20777 deletions

View file

@ -1,3 +1,17 @@
2012-11-02 Wolfgang Lux <wlux@uni-muenster.de>
* configure.ac: Use AC_FUNC_STRERROR_R to check for presence and
version of the strerror_r function.
* Source/Additions/NSError+GNUstepBase.m (-_systemError:): Add
conditional code for glibc specific version of strerror_r.
* Source/common.h: No longer redefine feature test macros as this
could invalidate the autoconf results.
* configure:
* Headers/GNUstepBase/config.h.in:
* SSL/configure:
* SSL/config.h.in: Regenerated by autoreconf.
2012-10-30 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/NSError+GNUstepBase.m:

View file

@ -198,6 +198,10 @@
/* Define to 1 if you have the `ctime' function. */
#undef HAVE_CTIME
/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
don't. */
#undef HAVE_DECL_STRERROR_R
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#undef HAVE_DIRENT_H
@ -750,6 +754,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
@ -789,6 +796,9 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if strerror_r returns char *. */
#undef STRERROR_R_CHAR_P
/* Define if the compiler provides builtins for atomic operations */
#undef USE_ATOMIC_BUILTINS

View file

@ -96,6 +96,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION

4965
SSL/configure vendored

File diff suppressed because it is too large Load diff

View file

@ -128,17 +128,31 @@ strerror_r(int eno, char *buf, int len)
#else
NSString *message;
char buf[BUFSIZ];
# if STRERROR_R_CHAR_P
char *result;
# else
int result;
#endif
/* FIXME ... not all are POSIX, should we use NSMachErrorDomain for some? */
domain = NSPOSIXErrorDomain;
result = strerror_r(code, buf, BUFSIZ);
# if STRERROR_R_CHAR_P
if (result == 0)
{
snprintf(buf, sizeof(buf), "%ld", code);
result = buf;
}
message = [NSString stringWithCString: result
encoding: [NSString defaultCStringEncoding]];
# else
if (result < 0)
{
snprintf(buf, sizeof(buf), "%ld", code);
}
message = [NSString stringWithCString: buf
encoding: [NSString defaultCStringEncoding]];
# endif
/* FIXME ... can we do better localisation? */
info = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, NSLocalizedDescriptionKey,

View file

@ -6,40 +6,6 @@
#import "config.h"
/* Disable extensions (config.h may have turned them on) ...
* we want to use standard code.
*/
#if defined(_GNU_SOURCE)
# undef _GNU_SOURCE
#endif
/* Ensure we have _XOPEN_SOURCE turned on at the appropriate
* level for the facilities we need.
*
* Minimum of 600 for string.h so we get the POSIX strerror_r() behavior
* on systems using glibc.
*
* Any systems where using XOPEN causes problems can define GSXOPEN to 0
*/
#if defined(__FreeBSD__)
# define GSXOPEN 0
#else
# define GSXOPEN 600
#endif
#if GSXOPEN > 0
# if defined(_XOPEN_SOURCE)
# if _XOPEN_SOURCE < GSXOPEN
# undef _XOPEN_SOURCE
# define _XOPEN_SOURCE GSXOPEN
# endif
# else
# define _XOPEN_SOURCE GSXOPEN
# endif
#endif
#if defined(HAVE_STRING_H)
/* For POSIX strerror_r() and others
*/

21177
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -2341,7 +2341,8 @@ AC_CHECK_FUNCS(setrlimit)
#--------------------------------------------------------------------
# One of these functions needed by NSDebug.m and NSProcessInfo.m
#--------------------------------------------------------------------
AC_CHECK_FUNCS(strerror_r strerror)
AC_CHECK_FUNCS(strerror)
AC_FUNC_STRERROR_R
#--------------------------------------------------------------------
# Needed by NSDebug.m