summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/fcntl.in.h2
-rw-r--r--lib/freading.c2
-rw-r--r--lib/freading.h2
-rw-r--r--lib/gettext.h2
-rw-r--r--lib/hard-locale.c2
-rw-r--r--lib/localename.c4
-rw-r--r--lib/mbrtowc.c2
-rw-r--r--lib/printf-parse.c2
-rw-r--r--lib/printf-parse.h2
-rw-r--r--lib/propername.c3
-rw-r--r--lib/relocatable.c5
-rw-r--r--lib/spawn.in.h2
-rw-r--r--lib/strerror_r.c6
-rw-r--r--lib/striconv.c29
-rw-r--r--lib/striconveh.c28
-rw-r--r--lib/striconveha.c10
-rw-r--r--lib/string.in.h14
-rw-r--r--lib/unicodeio.c4
-rw-r--r--lib/uniconv/u16-conv-from-enc.c2
-rw-r--r--lib/uniconv/u16-conv-to-enc.c2
-rw-r--r--lib/uniconv/u16-strconv-to-enc.c2
-rw-r--r--lib/uniconv/u32-conv-from-enc.c2
-rw-r--r--lib/uniconv/u32-conv-to-enc.c2
-rw-r--r--lib/uniconv/u32-strconv-to-enc.c2
-rw-r--r--lib/unistr/u8-stpncpy.c2
-rw-r--r--lib/unistr/u8-strnlen.c2
-rw-r--r--lib/vasnprintf.c6
-rw-r--r--lib/xmalloc.c2
28 files changed, 85 insertions, 60 deletions
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index 13f5dde97b..6d1888de47 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -32,7 +32,7 @@
extern "C" { ... } block, which leads to errors in C++ mode with the
overridden <sys/stat.h> from gnulib. These errors are known to be gone
with g++ version >= 4.3. */
-#if !defined __GLIBC__ || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
+#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
# include <sys/stat.h>
#endif
#@INCLUDE_NEXT@ @NEXT_FCNTL_H@
diff --git a/lib/freading.c b/lib/freading.c
index bb78a1bcb5..202c3f76c3 100644
--- a/lib/freading.c
+++ b/lib/freading.c
@@ -23,7 +23,7 @@
/* Don't use glibc's __freading function in glibc < 2.7, see
<http://sourceware.org/bugzilla/show_bug.cgi?id=4359> */
-#if !(HAVE___FREADING && (!defined __GLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)))
+#if !(HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)))
bool
freading (FILE *fp)
diff --git a/lib/freading.h b/lib/freading.h
index 9b3b6c6a8d..5bc12fbd18 100644
--- a/lib/freading.h
+++ b/lib/freading.h
@@ -32,7 +32,7 @@
STREAM must not be wide-character oriented. */
-#if HAVE___FREADING && (!defined __GLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))
+#if HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))
/* Solaris >= 7, not glibc >= 2.2, but glibc >= 2.7 */
# include <stdio_ext.h>
diff --git a/lib/gettext.h b/lib/gettext.h
index 6a069c4486..892bf2245d 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -54,7 +54,7 @@
it now, to make later inclusions of <libintl.h> a NOP. */
#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
# include <cstdlib>
-# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H
+# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
# include <libintl.h>
# endif
#endif
diff --git a/lib/hard-locale.c b/lib/hard-locale.c
index c868ac0f13..14a0036da7 100644
--- a/lib/hard-locale.c
+++ b/lib/hard-locale.c
@@ -26,6 +26,8 @@
#ifdef __GLIBC__
# define GLIBC_VERSION __GLIBC__
+#elif defined __UCLIBC__
+# define GLIBC_VERSION 2
#else
# define GLIBC_VERSION 0
#endif
diff --git a/lib/localename.c b/lib/localename.c
index ea646c5087..d398053ca9 100644
--- a/lib/localename.c
+++ b/lib/localename.c
@@ -2607,7 +2607,7 @@ gl_locale_name_thread_unsafe (int category, const char *categoryname)
locale_t thread_locale = uselocale (NULL);
if (thread_locale != LC_GLOBAL_LOCALE)
{
-# if __GLIBC__ >= 2
+# if __GLIBC__ >= 2 && !defined __UCLIBC__
/* Work around an incorrect definition of the _NL_LOCALE_NAME macro in
glibc < 2.12.
See <http://sourceware.org/bugzilla/show_bug.cgi?id=10968>. */
@@ -2771,7 +2771,7 @@ gl_locale_name_thread (int category, const char *categoryname)
However it does not specify the exact format. Neither do SUSV2 and
ISO C 99. So we can use this feature only on selected systems (e.g.
those using GNU C Library). */
-#if defined _LIBC || (defined __GLIBC__ && __GLIBC__ >= 2)
+#if defined _LIBC || ((defined __GLIBC__ && __GLIBC__ >= 2) && !defined __UCLIBC__)
# define HAVE_LOCALE_NULL
#endif
diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c
index 5c2650e952..25dac59e7f 100644
--- a/lib/mbrtowc.c
+++ b/lib/mbrtowc.c
@@ -91,7 +91,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
/* Here m > 0. */
-# if __GLIBC__
+# if __GLIBC__ || defined __UCLIBC__
/* Work around bug <http://sourceware.org/bugzilla/show_bug.cgi?id=9674> */
mbtowc (NULL, NULL, 0);
# endif
diff --git a/lib/printf-parse.c b/lib/printf-parse.c
index d54ce6de81..04072a517f 100644
--- a/lib/printf-parse.c
+++ b/lib/printf-parse.c
@@ -206,7 +206,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
dp->flags |= FLAG_ZERO;
cp++;
}
-#if __GLIBC__ >= 2
+#if __GLIBC__ >= 2 && !defined __UCLIBC__
else if (*cp == 'I')
{
dp->flags |= FLAG_LOCALIZED;
diff --git a/lib/printf-parse.h b/lib/printf-parse.h
index 67a4a2a21e..6bd11dfa1a 100644
--- a/lib/printf-parse.h
+++ b/lib/printf-parse.h
@@ -33,7 +33,7 @@
#define FLAG_SPACE 8 /* space flag */
#define FLAG_ALT 16 /* # flag */
#define FLAG_ZERO 32
-#if __GLIBC__ >= 2
+#if __GLIBC__ >= 2 && !defined __UCLIBC__
# define FLAG_LOCALIZED 64 /* I flag, uses localized digits */
#endif
diff --git a/lib/propername.c b/lib/propername.c
index 3971f3f7a5..fd105ee069 100644
--- a/lib/propername.c
+++ b/lib/propername.c
@@ -198,7 +198,8 @@ proper_name_utf8 (const char *name_ascii, const char *name_utf8)
name_converted = alloc_name_converted =
xstr_iconv (name_utf8, "UTF-8", locale_code);
-# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 \
+# if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) \
+ && !defined __UCLIBC__) \
|| _LIBICONV_VERSION >= 0x0105
{
char *converted_translit;
diff --git a/lib/relocatable.c b/lib/relocatable.c
index f0ac6d1058..243248ec57 100644
--- a/lib/relocatable.c
+++ b/lib/relocatable.c
@@ -344,8 +344,9 @@ DllMain (HINSTANCE module_handle, DWORD event, LPVOID reserved)
static void
find_shared_library_fullname ()
{
-#if defined __linux__ && __GLIBC__ >= 2
- /* Linux has /proc/self/maps. glibc 2 has the getline() function. */
+#if defined __linux__ && (__GLIBC__ >= 2 || defined __UCLIBC__)
+ /* Linux has /proc/self/maps. glibc 2 and uClibc have the getline()
+ function. */
FILE *fp;
/* Open the current process' maps file. It describes one VMA per line. */
diff --git a/lib/spawn.in.h b/lib/spawn.in.h
index 26c3c10a37..b29e25a709 100644
--- a/lib/spawn.in.h
+++ b/lib/spawn.in.h
@@ -32,7 +32,7 @@
/* Get definitions of 'struct sched_param' and 'sigset_t'.
But avoid namespace pollution on glibc systems. */
-#ifndef __GLIBC__
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
# include <sched.h>
# include <signal.h>
#endif
diff --git a/lib/strerror_r.c b/lib/strerror_r.c
index ec89762d72..dc7ea88dce 100644
--- a/lib/strerror_r.c
+++ b/lib/strerror_r.c
@@ -24,7 +24,7 @@
#include <errno.h>
-#if HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2) && !EXTEND_STRERROR_R
+#if HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__) && !EXTEND_STRERROR_R
/* The system's strerror_r function is OK, except that its third argument
is 'int', not 'size_t'. */
@@ -90,7 +90,7 @@ strerror_r (int errnum, char *buf, size_t buflen)
return (ret < 0 ? errno : ret);
}
-#elif __GLIBC__ >= 2 && HAVE___XPG_STRERROR_R /* glibc >= 2.3.4 */ && !EXTEND_STRERROR_R
+#elif (__GLIBC__ >= 2 || defined __UCLIBC__) && HAVE___XPG_STRERROR_R /* glibc >= 2.3.4 */ && !EXTEND_STRERROR_R
int
strerror_r (int errnum, char *buf, size_t buflen)
@@ -101,7 +101,7 @@ strerror_r (int errnum, char *buf, size_t buflen)
return (ret < 0 ? errno : 0);
}
-#else /* (__GLIBC__ >= 2 ? !HAVE___XPG_STRERROR_R : !HAVE_DECL_STRERROR_R) || EXTEND_STRERROR_R */
+#else /* (__GLIBC__ >= 2 || defined __UCLIBC__ ? !HAVE___XPG_STRERROR_R : !HAVE_DECL_STRERROR_R) || EXTEND_STRERROR_R */
# include "glthread/lock.h"
diff --git a/lib/striconv.c b/lib/striconv.c
index 35bae57688..19b3d3cb28 100644
--- a/lib/striconv.c
+++ b/lib/striconv.c
@@ -1,5 +1,5 @@
/* Charset conversion.
- Copyright (C) 2001-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2001-2007, 2010 Free Software Foundation, Inc.
Written by Bruno Haible and Simon Josefsson.
This program is free software; you can redistribute it and/or modify
@@ -50,7 +50,8 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
/* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
+ || defined __sun)
/* Set to the initial state. */
iconv (cd, NULL, NULL, NULL, NULL);
# endif
@@ -82,7 +83,7 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
else
return -1;
}
-# if !defined _LIBICONV_VERSION && !defined __GLIBC__
+# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__)
/* Irix iconv() inserts a NUL byte if it cannot convert.
NetBSD iconv() inserts a question mark if it cannot convert.
Only GNU libiconv and GNU libc are known to prefer to fail rather
@@ -97,7 +98,8 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
}
/* Avoid glibc-2.1 bug and Solaris 2.7 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
+ || defined __sun)
{
char *outptr = tmpbuf;
size_t outsize = tmpbufsize;
@@ -131,7 +133,8 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
/* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
+ || defined __sun)
/* Return to the initial state. */
iconv (cd, NULL, NULL, NULL, NULL);
# endif
@@ -156,7 +159,7 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
else
goto fail;
}
-# if !defined _LIBICONV_VERSION && !defined __GLIBC__
+# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__)
/* Irix iconv() inserts a NUL byte if it cannot convert.
NetBSD iconv() inserts a question mark if it cannot convert.
Only GNU libiconv and GNU libc are known to prefer to fail rather
@@ -170,7 +173,8 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
}
/* Avoid glibc-2.1 bug and Solaris 2.7 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
+ || defined __sun)
{
size_t res = iconv (cd, NULL, NULL, &outptr, &outsize);
@@ -207,7 +211,7 @@ str_cd_iconv (const char *src, iconv_t cd)
to a trailing NUL byte in the output. But not for UTF-7. So that this
function is usable for UTF-7, we have to exclude the NUL byte from the
conversion and add it by hand afterwards. */
-# if !defined _LIBICONV_VERSION && !defined __GLIBC__
+# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__)
/* Irix iconv() inserts a NUL byte if it cannot convert.
NetBSD iconv() inserts a question mark if it cannot convert.
Only GNU libiconv and GNU libc are known to prefer to fail rather
@@ -272,7 +276,8 @@ str_cd_iconv (const char *src, iconv_t cd)
/* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
+ || defined __sun)
/* Set to the initial state. */
iconv (cd, NULL, NULL, NULL, NULL);
# endif
@@ -324,7 +329,8 @@ str_cd_iconv (const char *src, iconv_t cd)
}
/* Avoid glibc-2.1 bug and Solaris 2.7 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
+ || defined __sun)
for (;;)
{
/* Here outptr + outbytes_remaining = result + result_size - 1. */
@@ -410,7 +416,8 @@ str_iconv (const char *src, const char *from_codeset, const char *to_codeset)
char *result;
/* Avoid glibc-2.1 bug with EUC-KR. */
-# if (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) && !defined _LIBICONV_VERSION
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
+ && !defined _LIBICONV_VERSION
if (c_strcasecmp (from_codeset, "EUC-KR") == 0
|| c_strcasecmp (to_codeset, "EUC-KR") == 0)
{
diff --git a/lib/striconveh.c b/lib/striconveh.c
index 8d73d291fb..efbbe72f50 100644
--- a/lib/striconveh.c
+++ b/lib/striconveh.c
@@ -52,7 +52,8 @@ iconveh_open (const char *to_codeset, const char *from_codeset, iconveh_t *cdp)
iconv_t cd2;
/* Avoid glibc-2.1 bug with EUC-KR. */
-# if (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) && !defined _LIBICONV_VERSION
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
+ && !defined _LIBICONV_VERSION
if (c_strcasecmp (from_codeset, "EUC-KR") == 0
|| c_strcasecmp (to_codeset, "EUC-KR") == 0)
{
@@ -79,7 +80,9 @@ iconveh_open (const char *to_codeset, const char *from_codeset, iconveh_t *cdp)
}
if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0)
-# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 || _LIBICONV_VERSION >= 0x0105
+# if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) \
+ && !defined __UCLIBC__) \
+ || _LIBICONV_VERSION >= 0x0105
|| c_strcasecmp (to_codeset, "UTF-8//TRANSLIT") == 0
# endif
)
@@ -136,7 +139,7 @@ iconveh_close (const iconveh_t *cd)
/* iconv_carefully is like iconv, except that it stops as soon as it encounters
a conversion error, and it returns in *INCREMENTED a boolean telling whether
it has incremented the input pointers past the error location. */
-# if !defined _LIBICONV_VERSION && !defined __GLIBC__
+# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__)
/* Irix iconv() inserts a NUL byte if it cannot convert.
NetBSD iconv() inserts a question mark if it cannot convert.
Only GNU libiconv and GNU libc are known to prefer to fail rather
@@ -244,7 +247,7 @@ iconv_carefully_1 (iconv_t cd,
*inbuf = inptr;
*inbytesleft = inptr_end - inptr;
-# if !defined _LIBICONV_VERSION && !defined __GLIBC__
+# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__)
/* Irix iconv() inserts a NUL byte if it cannot convert.
NetBSD iconv() inserts a question mark if it cannot convert.
Only GNU libiconv and GNU libc are known to prefer to fail rather
@@ -403,7 +406,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen,
/* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
+ || defined __sun)
/* Set to the initial state. */
iconv (cd, NULL, NULL, NULL, NULL);
# endif
@@ -531,7 +535,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen,
/* Now get the conversion state back to the initial state.
But avoid glibc-2.1 bug and Solaris 2.7 bug. */
#if defined _LIBICONV_VERSION \
- || !((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) || defined __sun)
+ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
+ || defined __sun)
for (;;)
{
char *outptr = result + length;
@@ -606,7 +611,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen,
/* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
+ || defined __sun)
/* Set to the initial state. */
if (cd1 != (iconv_t)(-1))
iconv (cd1, NULL, NULL, NULL, NULL);
@@ -658,7 +664,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen,
/* Now get the conversion state of CD1 back to the initial state.
But avoid glibc-2.1 bug and Solaris 2.7 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) || defined __sun)
+ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
+ || defined __sun)
if (cd1 != (iconv_t)(-1))
res1 = iconv (cd1, NULL, NULL, &out1ptr, &out1size);
else
@@ -740,7 +747,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen,
/* Now get the conversion state of CD1 back to the initial
state. But avoid glibc-2.1 bug and Solaris 2.7 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) || defined __sun)
+ || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \
+ || defined __sun)
if (cd2 != (iconv_t)(-1))
res2 = iconv (cd2, NULL, NULL, &out2ptr, &out2size);
else
@@ -883,7 +891,7 @@ mem_cd_iconveh_internal (const char *src, size_t srclen,
}
length = out2ptr - result;
}
-# if !defined _LIBICONV_VERSION && !defined __GLIBC__
+# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__)
/* Irix iconv() inserts a NUL byte if it cannot convert.
NetBSD iconv() inserts a question mark if it cannot
convert.
diff --git a/lib/striconveha.c b/lib/striconveha.c
index ade0ec7edd..2849065559 100644
--- a/lib/striconveha.c
+++ b/lib/striconveha.c
@@ -1,5 +1,5 @@
/* Character set conversion with error handling and autodetection.
- Copyright (C) 2002, 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2007, 2009-2010 Free Software Foundation, Inc.
Written by Bruno Haible.
This program is free software: you can redistribute it and/or modify
@@ -226,7 +226,9 @@ mem_iconveha (const char *src, size_t srclen,
/* When using GNU libc >= 2.2 or GNU libiconv >= 1.5,
we want to use transliteration. */
-#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 || _LIBICONV_VERSION >= 0x0105
+#if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) \
+ && !defined __UCLIBC__) \
+ || _LIBICONV_VERSION >= 0x0105
if (transliterate)
{
int retval;
@@ -326,7 +328,9 @@ str_iconveha (const char *src,
/* When using GNU libc >= 2.2 or GNU libiconv >= 1.5,
we want to use transliteration. */
-#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 || _LIBICONV_VERSION >= 0x0105
+#if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) \
+ && !defined __UCLIBC__) \
+ || _LIBICONV_VERSION >= 0x0105
if (transliterate)
{
char *result;
diff --git a/lib/string.in.h b/lib/string.in.h
index 0c431c5892..2167caf784 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -87,7 +87,7 @@ _GL_CXXALIAS_SYS_CAST2 (memchr,
void *, (void const *__s, int __c, size_t __n),
void const *, (void const *__s, int __c, size_t __n));
# endif
-# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n));
_GL_CXXALIASWARN1 (memchr, void const *,
@@ -172,7 +172,7 @@ _GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
_GL_CXXALIAS_SYS_CAST2 (memrchr,
void *, (void const *, int, size_t),
void const *, (void const *, int, size_t));
-# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t));
_GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t));
@@ -202,7 +202,7 @@ _GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
_GL_CXXALIAS_SYS_CAST2 (rawmemchr,
void *, (void const *__s, int __c_in),
void const *, (void const *__s, int __c_in));
-# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in));
_GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in));
@@ -293,7 +293,7 @@ _GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
_GL_CXXALIAS_SYS_CAST2 (strchrnul,
char *, (char const *__s, int __c_in),
char const *, (char const *__s, int __c_in));
-# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in));
_GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in));
@@ -439,7 +439,7 @@ _GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
_GL_CXXALIAS_SYS_CAST2 (strpbrk,
char *, (char const *__s, char const *__accept),
const char *, (char const *__s, char const *__accept));
-# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept));
_GL_CXXALIASWARN1 (strpbrk, char const *,
@@ -541,7 +541,7 @@ _GL_CXXALIAS_SYS_CAST2 (strstr,
char *, (const char *haystack, const char *needle),
const char *, (const char *haystack, const char *needle));
# endif
-# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle));
_GL_CXXALIASWARN1 (strstr, const char *,
@@ -590,7 +590,7 @@ _GL_CXXALIAS_SYS_CAST2 (strcasestr,
char *, (const char *haystack, const char *needle),
const char *, (const char *haystack, const char *needle));
# endif
-# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle));
_GL_CXXALIASWARN1 (strcasestr, const char *,
diff --git a/lib/unicodeio.c b/lib/unicodeio.c
index 6f1f61d215..1ba8a287fc 100644
--- a/lib/unicodeio.c
+++ b/lib/unicodeio.c
@@ -140,7 +140,9 @@ unicode_to_mb (unsigned int code,
/* Avoid glibc-2.1 bug and Solaris 7 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+ || !(((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) \
+ && !defined __UCLIBC__) \
+ || defined __sun)
/* Get back to the initial shift state. */
res = iconv (utf8_to_local, NULL, NULL, &outptr, &outbytesleft);
diff --git a/lib/uniconv/u16-conv-from-enc.c b/lib/uniconv/u16-conv-from-enc.c
index dc4c21d2ad..919709f906 100644
--- a/lib/uniconv/u16-conv-from-enc.c
+++ b/lib/uniconv/u16-conv-from-enc.c
@@ -28,7 +28,7 @@
#include "unistr.h"
/* Name of UTF-16 encoding with machine dependent endianness and alignment. */
-#if defined _LIBICONV_VERSION || (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
+#if defined _LIBICONV_VERSION || (((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) && !defined __UCLIBC__)
# ifdef WORDS_BIGENDIAN
# define UTF16_NAME "UTF-16BE"
# else
diff --git a/lib/uniconv/u16-conv-to-enc.c b/lib/uniconv/u16-conv-to-enc.c
index cce454d59c..1091394467 100644
--- a/lib/uniconv/u16-conv-to-enc.c
+++ b/lib/uniconv/u16-conv-to-enc.c
@@ -31,7 +31,7 @@
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
/* Name of UTF-16 encoding with machine dependent endianness and alignment. */
-#if defined _LIBICONV_VERSION || (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
+#if defined _LIBICONV_VERSION || (((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) && !defined __UCLIBC__)
# ifdef WORDS_BIGENDIAN
# define UTF16_NAME "UTF-16BE"
# else
diff --git a/lib/uniconv/u16-strconv-to-enc.c b/lib/uniconv/u16-strconv-to-enc.c
index c8e00e7644..e841e7db20 100644
--- a/lib/uniconv/u16-strconv-to-enc.c
+++ b/lib/uniconv/u16-strconv-to-enc.c
@@ -31,7 +31,7 @@
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
/* Name of UTF-16 encoding with machine dependent endianness and alignment. */
-#if defined _LIBICONV_VERSION || (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
+#if defined _LIBICONV_VERSION || (((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) && !defined __UCLIBC__)
# ifdef WORDS_BIGENDIAN
# define UTF16_NAME "UTF-16BE"
# else
diff --git a/lib/uniconv/u32-conv-from-enc.c b/lib/uniconv/u32-conv-from-enc.c
index f5c6e8e1a3..cb9a9ee89c 100644
--- a/lib/uniconv/u32-conv-from-enc.c
+++ b/lib/uniconv/u32-conv-from-enc.c
@@ -31,7 +31,7 @@
alignment. */
#if defined _LIBICONV_VERSION
# define UTF32_NAME "UCS-4-INTERNAL"
-#elif (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
+#elif ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) && !defined __UCLIBC__
# define UTF32_NAME "WCHAR_T"
#endif
diff --git a/lib/uniconv/u32-conv-to-enc.c b/lib/uniconv/u32-conv-to-enc.c
index 7bfc9f4605..f26478f909 100644
--- a/lib/uniconv/u32-conv-to-enc.c
+++ b/lib/uniconv/u32-conv-to-enc.c
@@ -34,7 +34,7 @@
alignment. */
#if defined _LIBICONV_VERSION
# define UTF32_NAME "UCS-4-INTERNAL"
-#elif (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
+#elif ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) && !defined __UCLIBC__
# define UTF32_NAME "WCHAR_T"
#endif
diff --git a/lib/uniconv/u32-strconv-to-enc.c b/lib/uniconv/u32-strconv-to-enc.c
index fd45013e53..b347735678 100644
--- a/lib/uniconv/u32-strconv-to-enc.c
+++ b/lib/uniconv/u32-strconv-to-enc.c
@@ -34,7 +34,7 @@
alignment. */
#if defined _LIBICONV_VERSION
# define UTF32_NAME "UCS-4-INTERNAL"
-#elif (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
+#elif ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) && !defined __UCLIBC__
# define UTF32_NAME "WCHAR_T"
#endif
diff --git a/lib/unistr/u8-stpncpy.c b/lib/unistr/u8-stpncpy.c
index a456beac28..5047c7b8d0 100644
--- a/lib/unistr/u8-stpncpy.c
+++ b/lib/unistr/u8-stpncpy.c
@@ -25,7 +25,7 @@
/* Specification. */
#include "unistr.h"
-#if __GLIBC__ >= 2
+#if __GLIBC__ >= 2 && !defined __UCLIBC__
# include <string.h>
diff --git a/lib/unistr/u8-strnlen.c b/lib/unistr/u8-strnlen.c
index e732ea2ea6..12ab53df07 100644
--- a/lib/unistr/u8-strnlen.c
+++ b/lib/unistr/u8-strnlen.c
@@ -25,7 +25,7 @@
/* Specification. */
#include "unistr.h"
-#if __GLIBC__ >= 2
+#if __GLIBC__ >= 2 || defined __UCLIBC__
# include <string.h>
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 18c5e39e80..63a9f97065 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -279,7 +279,7 @@ decimal_point_char (void)
multithread-safe on glibc systems and MacOS X systems, but is not required
to be multithread-safe by POSIX. sprintf(), however, is multithread-safe.
localeconv() is rarely multithread-safe. */
-# if HAVE_NL_LANGINFO && (__GLIBC__ || (defined __APPLE__ && defined __MACH__))
+# if HAVE_NL_LANGINFO && (__GLIBC__ || defined __UCLIBC__ || (defined __APPLE__ && defined __MACH__))
point = nl_langinfo (RADIXCHAR);
# elif 1
char pointbuf[5];
@@ -4754,7 +4754,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
*fbp++ = ' ';
if (flags & FLAG_ALT)
*fbp++ = '#';
-#if __GLIBC__ >= 2
+#if __GLIBC__ >= 2 && !defined __UCLIBC__
if (flags & FLAG_LOCALIZED)
*fbp++ = 'I';
#endif
@@ -4841,7 +4841,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
#endif
*fbp = dp->conversion;
#if USE_SNPRINTF
-# if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
+# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
fbp[1] = '%';
fbp[2] = 'n';
fbp[3] = '\0';
diff --git a/lib/xmalloc.c b/lib/xmalloc.c
index f06d44fb5f..e9761c368b 100644
--- a/lib/xmalloc.c
+++ b/lib/xmalloc.c
@@ -31,7 +31,7 @@
/* 1 if calloc is known to be compatible with GNU calloc. This
matters if we are not also using the calloc module, which defines
HAVE_CALLOC_GNU and supports the GNU API even on non-GNU platforms. */
-#if defined HAVE_CALLOC_GNU || defined __GLIBC__
+#if defined HAVE_CALLOC_GNU || (defined __GLIBC__ && !defined __UCLIBC__)
enum { HAVE_GNU_CALLOC = 1 };
#else
enum { HAVE_GNU_CALLOC = 0 };