From 63bc47a1fecb6e16b620d95fc6f5313f317bb550 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 20 Nov 2010 18:54:00 +0100 Subject: [PATCH] Port to uClibc. * lib/relocatable.c (find_shared_library_fullname): Treat uClibc like glibc. * lib/strerror_r.c: Likewise. * m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET): Likewise. * m4/duplocale.m4 (gl_FUNC_DUPLOCALE): Likewise. * m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE): Likewise. * m4/glibc21.m4 (gl_GLIBC21): Likewise. * tests/test-sigaction.c (handler, main): Likewise. * lib/localename.c (gl_locale_name_thread_unsafe, HAVE_LOCALE_NULL): Treat uClibc like a non-glibc platform. * lib/propername.c (proper_name_utf8): Likewise. * lib/spawn.in.h: Likewise. * lib/striconv.c (mem_cd_iconv, str_cd_iconv, str_iconv): Likewise. * lib/striconveh.c (iconveh_open, iconv_carefully, iconv_carefully_1, mem_cd_iconveh_internal): Likewise. * lib/striconveha.c (mem_iconveha, str_iconveha): Likewise. * lib/string.in.h (memchr, memrchr, rawmemchr, strchrnul, strpbrk, strstr, strcasestr): Likewise. * lib/unicodeio.c (unicode_to_mb): Likewise. * m4/getdelim.m4 (gl_FUNC_GETDELIM): Likewise. * m4/getline.m4 (gl_FUNC_GETLINE): Likewise. * m4/glibc2.m4 (gt_GLIBC2): Likewise. * m4/iconv_open.m4 (gl_FUNC_ICONV_OPEN): Likewise. * m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE, gl_FUNC_MEMMEM): Likewise. * m4/printf.m4 (gl_PRINTF_DIRECTIVE_A): Likewise. * m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE, gl_FUNC_STRCASESTR): Likewise. * m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE, gl_FUNC_STRSTR): Likewise. * m4/strtod.m4 (gl_FUNC_STRTOD): Likewise. * m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_H): Likewise. * m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise. * m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Likewise. * m4/sys_times_h.m4 (gl_SYS_TIMES_H): Likewise. * m4/unistd_h.m4 (gl_UNISTD_H): Likewise. * m4/wchar_h.m4 (gl_WCHAR_H): Likewise. * tests/test-getopt.h (OPTIND_MIN): Likewise. * tests/test-striconveha.c (main): Likewise. * doc/posix-functions/getdelim.texi: Mention an uClibc bug. * doc/posix-functions/getline.texi: Likewise. Reported by Mike Frysinger . --- ChangeLog | 44 +++++++++++++++++++++++++++++++++++++++ build-aux/link-warning.h | 2 +- doc/posix-functions/getdelim.texi | 3 +++ doc/posix-functions/getline.texi | 3 +++ lib/fcntl.in.h | 2 +- lib/freading.c | 2 +- lib/freading.h | 2 +- lib/gettext.h | 2 +- lib/hard-locale.c | 2 ++ lib/localename.c | 4 ++-- lib/mbrtowc.c | 2 +- lib/printf-parse.c | 2 +- lib/printf-parse.h | 2 +- lib/propername.c | 3 ++- lib/relocatable.c | 5 +++-- lib/spawn.in.h | 2 +- lib/strerror_r.c | 6 +++--- lib/striconv.c | 29 ++++++++++++++++---------- lib/striconveh.c | 28 ++++++++++++++++--------- lib/striconveha.c | 10 ++++++--- lib/string.in.h | 14 ++++++------- lib/unicodeio.c | 4 +++- lib/uniconv/u16-conv-from-enc.c | 2 +- lib/uniconv/u16-conv-to-enc.c | 2 +- lib/uniconv/u16-strconv-to-enc.c | 2 +- lib/uniconv/u32-conv-from-enc.c | 2 +- lib/uniconv/u32-conv-to-enc.c | 2 +- lib/uniconv/u32-strconv-to-enc.c | 2 +- lib/unistr/u8-stpncpy.c | 2 +- lib/unistr/u8-strnlen.c | 2 +- lib/vasnprintf.c | 6 +++--- lib/xmalloc.c | 2 +- m4/arpa_inet_h.m4 | 6 +++--- m4/duplocale.m4 | 9 +++++--- m4/fsusage.m4 | 4 ++-- m4/getdelim.m4 | 4 ++-- m4/getline.m4 | 4 ++-- m4/glibc2.m4 | 6 +++--- m4/glibc21.m4 | 13 +++++++----- m4/iconv_open.m4 | 4 ++-- m4/memmem.m4 | 8 ++++--- m4/printf.m4 | 4 ++-- m4/strcasestr.m4 | 8 ++++--- m4/strstr.m4 | 8 ++++--- m4/strtod.m4 | 5 +++-- m4/sys_ioctl_h.m4 | 4 ++-- m4/sys_select_h.m4 | 4 ++-- m4/sys_socket_h.m4 | 4 ++-- m4/sys_times_h.m4 | 4 ++-- m4/unistd_h.m4 | 4 ++-- m4/wchar_h.m4 | 4 ++-- tests/test-getopt.h | 2 +- tests/test-sigaction.c | 4 ++-- tests/test-striconveha.c | 4 ++-- tests/test-vasnprintf-posix.c | 2 +- tests/test-vasnprintf-posix3.c | 4 ++-- 56 files changed, 204 insertions(+), 116 deletions(-) diff --git a/ChangeLog b/ChangeLog index 294b3aabf..2aa86b60c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,49 @@ 2010-11-20 Bruno Haible + Port to uClibc. + * lib/relocatable.c (find_shared_library_fullname): Treat uClibc like + glibc. + * lib/strerror_r.c: Likewise. + * m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET): Likewise. + * m4/duplocale.m4 (gl_FUNC_DUPLOCALE): Likewise. + * m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE): Likewise. + * m4/glibc21.m4 (gl_GLIBC21): Likewise. + * tests/test-sigaction.c (handler, main): Likewise. + * lib/localename.c (gl_locale_name_thread_unsafe, HAVE_LOCALE_NULL): + Treat uClibc like a non-glibc platform. + * lib/propername.c (proper_name_utf8): Likewise. + * lib/spawn.in.h: Likewise. + * lib/striconv.c (mem_cd_iconv, str_cd_iconv, str_iconv): Likewise. + * lib/striconveh.c (iconveh_open, iconv_carefully, iconv_carefully_1, + mem_cd_iconveh_internal): Likewise. + * lib/striconveha.c (mem_iconveha, str_iconveha): Likewise. + * lib/string.in.h (memchr, memrchr, rawmemchr, strchrnul, strpbrk, + strstr, strcasestr): Likewise. + * lib/unicodeio.c (unicode_to_mb): Likewise. + * m4/getdelim.m4 (gl_FUNC_GETDELIM): Likewise. + * m4/getline.m4 (gl_FUNC_GETLINE): Likewise. + * m4/glibc2.m4 (gt_GLIBC2): Likewise. + * m4/iconv_open.m4 (gl_FUNC_ICONV_OPEN): Likewise. + * m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE, gl_FUNC_MEMMEM): Likewise. + * m4/printf.m4 (gl_PRINTF_DIRECTIVE_A): Likewise. + * m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE, gl_FUNC_STRCASESTR): + Likewise. + * m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE, gl_FUNC_STRSTR): Likewise. + * m4/strtod.m4 (gl_FUNC_STRTOD): Likewise. + * m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_H): Likewise. + * m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise. + * m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Likewise. + * m4/sys_times_h.m4 (gl_SYS_TIMES_H): Likewise. + * m4/unistd_h.m4 (gl_UNISTD_H): Likewise. + * m4/wchar_h.m4 (gl_WCHAR_H): Likewise. + * tests/test-getopt.h (OPTIND_MIN): Likewise. + * tests/test-striconveha.c (main): Likewise. + * doc/posix-functions/getdelim.texi: Mention an uClibc bug. + * doc/posix-functions/getline.texi: Likewise. + Reported by Mike Frysinger . + +2010-11-20 Bruno Haible + nproc: Fix condition. * lib/nproc.c: Test HAVE_PTHREAD_GETAFFINITY_NP, not HAVE_PTHREAD_AFFINITY_NP. diff --git a/build-aux/link-warning.h b/build-aux/link-warning.h index 4c1e32d59..cd01b50e9 100644 --- a/build-aux/link-warning.h +++ b/build-aux/link-warning.h @@ -24,7 +24,7 @@ Testing __GLIBC__ is sufficient for asserting that GNU ld is in use. Testing __ELF__ guarantees the ELF object format. Testing __GNUC__ is necessary for the compound expression syntax. */ -# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__ +# if (defined __GLIBC__ || defined __UCLIBC__) && defined __ELF__ && defined __GNUC__ # define GL_LINK_WARNING(message) \ GL_LINK_WARNING1 (__FILE__, __LINE__, message) # define GL_LINK_WARNING1(file, line, message) \ diff --git a/doc/posix-functions/getdelim.texi b/doc/posix-functions/getdelim.texi index fac1196f0..fb593758a 100644 --- a/doc/posix-functions/getdelim.texi +++ b/doc/posix-functions/getdelim.texi @@ -22,4 +22,7 @@ FreeBSD 8.0. Portability problems not fixed by Gnulib: @itemize +@item +This function has quadratic running time for long lines on some platforms: +uClibc 0.9.31. @end itemize diff --git a/doc/posix-functions/getline.texi b/doc/posix-functions/getline.texi index 375473b22..a3f7d6458 100644 --- a/doc/posix-functions/getline.texi +++ b/doc/posix-functions/getline.texi @@ -25,4 +25,7 @@ FreeBSD 8.0. Portability problems not fixed by Gnulib: @itemize +@item +This function has quadratic running time for long lines on some platforms: +uClibc 0.9.31. @end itemize diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index 13f5dde97..6d1888de4 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 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 #endif #@INCLUDE_NEXT@ @NEXT_FCNTL_H@ diff --git a/lib/freading.c b/lib/freading.c index bb78a1bcb..202c3f76c 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 */ -#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 9b3b6c6a8..5bc12fbd1 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 diff --git a/lib/gettext.h b/lib/gettext.h index 6a069c448..892bf2245 100644 --- a/lib/gettext.h +++ b/lib/gettext.h @@ -54,7 +54,7 @@ it now, to make later inclusions of a NOP. */ #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) # include -# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H +# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H # include # endif #endif diff --git a/lib/hard-locale.c b/lib/hard-locale.c index c868ac0f1..14a0036da 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 ea646c508..d398053ca 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 . */ @@ -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 5c2650e95..25dac59e7 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 */ mbtowc (NULL, NULL, 0); # endif diff --git a/lib/printf-parse.c b/lib/printf-parse.c index d54ce6de8..04072a517 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 67a4a2a21..6bd11dfa1 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 3971f3f7a..fd105ee06 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 f0ac6d105..243248ec5 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 26c3c10a3..b29e25a70 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 # include #endif diff --git a/lib/strerror_r.c b/lib/strerror_r.c index ec89762d7..dc7ea88dc 100644 --- a/lib/strerror_r.c +++ b/lib/strerror_r.c @@ -24,7 +24,7 @@ #include -#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 35bae5768..19b3d3cb2 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 8d73d291f..efbbe72f5 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 ade0ec7ed..284906555 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 0c431c589..2167caf78 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 6f1f61d21..1ba8a287f 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 dc4c21d2a..919709f90 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 cce454d59..109139446 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 c8e00e764..e841e7db2 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 f5c6e8e1a..cb9a9ee89 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 7bfc9f460..f26478f90 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 fd45013e5..b34773567 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 a456beac2..5047c7b8d 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 diff --git a/lib/unistr/u8-strnlen.c b/lib/unistr/u8-strnlen.c index e732ea2ea..12ab53df0 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 diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c index 18c5e39e8..63a9f9706 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 f06d44fb5..e9761c368 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 }; diff --git a/m4/arpa_inet_h.m4 b/m4/arpa_inet_h.m4 index 15a30e2bc..490a005ad 100644 --- a/m4/arpa_inet_h.m4 +++ b/m4/arpa_inet_h.m4 @@ -1,5 +1,5 @@ -# arpa_inet_h.m4 serial 8 -dnl Copyright (C) 2006, 2008, 2009, 2010 Free Software Foundation, Inc. +# arpa_inet_h.m4 serial 9 +dnl Copyright (C) 2006, 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -26,7 +26,7 @@ AC_DEFUN([gl_HEADER_ARPA_INET], dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ /* On some systems, this header is not self-consistent. */ -#ifndef __GLIBC__ +#if !(defined __GLIBC__ || defined __UCLIBC__) # include #endif #include diff --git a/m4/duplocale.m4 b/m4/duplocale.m4 index 4fc613757..6ddccb69c 100644 --- a/m4/duplocale.m4 +++ b/m4/duplocale.m4 @@ -1,4 +1,4 @@ -# duplocale.m4 serial 4 +# duplocale.m4 serial 5 dnl Copyright (C) 2009-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -31,17 +31,20 @@ int main () }]])], [gl_cv_func_duplocale_works=yes], [gl_cv_func_duplocale_works=no], - [dnl Guess it works except on glibc < 2.12 and AIX. + [dnl Guess it works except on glibc < 2.12, uClibc, and AIX. case "$host_os" in aix*) gl_cv_func_duplocale_works="guessing no";; *-gnu*) - AC_EGREP_CPP([Unlucky GNU user], [ + AC_EGREP_CPP([Unlucky], [ #include #ifdef __GNU_LIBRARY__ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12) Unlucky GNU user #endif #endif +#ifdef __UCLIBC__ + Unlucky user +#endif ], [gl_cv_func_duplocale_works="guessing no"], [gl_cv_func_duplocale_works="guessing yes"]) diff --git a/m4/fsusage.m4 b/m4/fsusage.m4 index 68684c274..897ee4cef 100644 --- a/m4/fsusage.m4 +++ b/m4/fsusage.m4 @@ -1,4 +1,4 @@ -# serial 26 +# serial 27 # Obtaining file system usage information. # Copyright (C) 1997-1998, 2000-2001, 2003-2010 Free Software Foundation, Inc. @@ -48,7 +48,7 @@ if test $ac_fsusage_space = no; then # OpenBSD >= 4.4, AIX, HP-UX, IRIX, Solaris, Cygwin, Interix, BeOS. AC_CACHE_CHECK([for statvfs function (SVR4)], [fu_cv_sys_stat_statvfs], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include -#if defined __GLIBC__ && defined __linux__ +#if (defined __GLIBC__ || defined __UCLIBC__) && defined __linux__ Do not use statvfs on systems with GNU libc on Linux, because that function stats all preceding entries in /proc/mounts, and that makes df hang if even one of the corresponding file systems is hard-mounted, but not available. diff --git a/m4/getdelim.m4 b/m4/getdelim.m4 index 4beb1501c..2bbd5cff6 100644 --- a/m4/getdelim.m4 +++ b/m4/getdelim.m4 @@ -1,4 +1,4 @@ -# getdelim.m4 serial 6 +# getdelim.m4 serial 7 dnl Copyright (C) 2005-2007, 2009-2010 Free Software Foundation, Inc. dnl @@ -57,7 +57,7 @@ AC_DEFUN([gl_FUNC_GETDELIM], [ #include #ifdef __GNU_LIBRARY__ - #if (__GLIBC__ >= 2) + #if (__GLIBC__ >= 2) && !defined __UCLIBC__ Lucky GNU user #endif #endif diff --git a/m4/getline.m4 b/m4/getline.m4 index 83005600d..0f8e3134d 100644 --- a/m4/getline.m4 +++ b/m4/getline.m4 @@ -1,4 +1,4 @@ -# getline.m4 serial 21 +# getline.m4 serial 22 dnl Copyright (C) 1998-2003, 2005-2007, 2009-2010 Free Software Foundation, dnl Inc. @@ -65,7 +65,7 @@ AC_DEFUN([gl_FUNC_GETLINE], [ #include #ifdef __GNU_LIBRARY__ - #if (__GLIBC__ >= 2) + #if (__GLIBC__ >= 2) && !defined __UCLIBC__ Lucky GNU user #endif #endif diff --git a/m4/glibc2.m4 b/m4/glibc2.m4 index f148c12c4..b92208a1c 100644 --- a/m4/glibc2.m4 +++ b/m4/glibc2.m4 @@ -1,5 +1,5 @@ -# glibc2.m4 serial 2 -dnl Copyright (C) 2000-2002, 2004, 2008-2010 Free Software Foundation, Inc. +# glibc2.m4 serial 3 +dnl Copyright (C) 2000-2002, 2004, 2008, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -15,7 +15,7 @@ AC_DEFUN([gt_GLIBC2], [ #include #ifdef __GNU_LIBRARY__ - #if (__GLIBC__ >= 2) + #if (__GLIBC__ >= 2) && !defined __UCLIBC__ Lucky GNU user #endif #endif diff --git a/m4/glibc21.m4 b/m4/glibc21.m4 index 68ada9d4d..bd08b381e 100644 --- a/m4/glibc21.m4 +++ b/m4/glibc21.m4 @@ -1,17 +1,17 @@ -# glibc21.m4 serial 4 -dnl Copyright (C) 2000-2002, 2004, 2008-2010 Free Software Foundation, Inc. +# glibc21.m4 serial 5 +dnl Copyright (C) 2000-2002, 2004, 2008, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -# Test for the GNU C Library, version 2.1 or newer. +# Test for the GNU C Library, version 2.1 or newer, or uClibc. # From Bruno Haible. AC_DEFUN([gl_GLIBC21], [ - AC_CACHE_CHECK([whether we are using the GNU C Library 2.1 or newer], + AC_CACHE_CHECK([whether we are using the GNU C Library >= 2.1 or uClibc], [ac_cv_gnu_library_2_1], - [AC_EGREP_CPP([Lucky GNU user], + [AC_EGREP_CPP([Lucky], [ #include #ifdef __GNU_LIBRARY__ @@ -19,6 +19,9 @@ AC_DEFUN([gl_GLIBC21], Lucky GNU user #endif #endif +#ifdef __UCLIBC__ + Lucky user +#endif ], [ac_cv_gnu_library_2_1=yes], [ac_cv_gnu_library_2_1=no]) diff --git a/m4/iconv_open.m4 b/m4/iconv_open.m4 index 8219ecf5c..7b2488095 100644 --- a/m4/iconv_open.m4 +++ b/m4/iconv_open.m4 @@ -1,4 +1,4 @@ -# iconv_open.m4 serial 8 +# iconv_open.m4 serial 9 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -16,7 +16,7 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN], dnl We know that GNU libiconv and GNU libc do. AC_EGREP_CPP([gnu_iconv], [ #include - #if defined _LIBICONV_VERSION || defined __GLIBC__ + #if defined _LIBICONV_VERSION || (defined __GLIBC__ && !defined __UCLIBC__) gnu_iconv #endif ], [gl_func_iconv_gnu=yes], [gl_func_iconv_gnu=no]) diff --git a/m4/memmem.m4 b/m4/memmem.m4 index fbaa7fb32..898d4c7c4 100644 --- a/m4/memmem.m4 +++ b/m4/memmem.m4 @@ -1,4 +1,4 @@ -# memmem.m4 serial 17 +# memmem.m4 serial 18 dnl Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009, 2010 Free Software dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -35,7 +35,8 @@ AC_DEFUN([gl_FUNC_MEMMEM_SIMPLE], [ #ifdef __GNU_LIBRARY__ #include - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2) + #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ + && !defined __UCLIBC__ Lucky user #endif #elif defined __CYGWIN__ @@ -98,7 +99,8 @@ static void quit (int sig) { exit (sig + 128); } [ #include #ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2) + #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ + && !defined __UCLIBC__ Lucky user #endif #endif diff --git a/m4/printf.m4 b/m4/printf.m4 index e850862c0..0751eab34 100644 --- a/m4/printf.m4 +++ b/m4/printf.m4 @@ -1,4 +1,4 @@ -# printf.m4 serial 35 +# printf.m4 serial 36 dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -533,7 +533,7 @@ int main () AC_EGREP_CPP([BZ2908], [ #include #ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2) + #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)) && !defined __UCLIBC__ BZ2908 #endif #endif diff --git a/m4/strcasestr.m4 b/m4/strcasestr.m4 index d17105e6c..e6a9f8a97 100644 --- a/m4/strcasestr.m4 +++ b/m4/strcasestr.m4 @@ -1,4 +1,4 @@ -# strcasestr.m4 serial 16 +# strcasestr.m4 serial 17 dnl Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -38,7 +38,8 @@ AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE], [ #ifdef __GNU_LIBRARY__ #include - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2) + #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ + && !defined __UCLIBC__ Lucky user #endif #elif defined __CYGWIN__ @@ -106,7 +107,8 @@ static void quit (int sig) { exit (sig + 128); } [ #include #ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2) + #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ + && !defined __UCLIBC__ Lucky user #endif #endif diff --git a/m4/strstr.m4 b/m4/strstr.m4 index d7f33f273..258ae5f90 100644 --- a/m4/strstr.m4 +++ b/m4/strstr.m4 @@ -1,4 +1,4 @@ -# strstr.m4 serial 10 +# strstr.m4 serial 11 dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -31,7 +31,8 @@ AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], [ #ifdef __GNU_LIBRARY__ #include - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2) + #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ + && !defined __UCLIBC__ Lucky user #endif #elif defined __CYGWIN__ @@ -94,7 +95,8 @@ static void quit (int sig) { exit (sig + 128); } [ #include #ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2) + #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ + && !defined __UCLIBC__ Lucky user #endif #endif diff --git a/m4/strtod.m4 b/m4/strtod.m4 index 922a538cf..2b85774ae 100644 --- a/m4/strtod.m4 +++ b/m4/strtod.m4 @@ -1,4 +1,4 @@ -# strtod.m4 serial 17 +# strtod.m4 serial 18 dnl Copyright (C) 2002-2003, 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -101,7 +101,8 @@ numeric_equal (double x, double y) [ #include #ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8) || (__GLIBC__ > 2) + #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8) || (__GLIBC__ > 2)) \ + && !defined __UCLIBC__ Lucky user #endif #endif diff --git a/m4/sys_ioctl_h.m4 b/m4/sys_ioctl_h.m4 index f6face257..5c342a5b1 100644 --- a/m4/sys_ioctl_h.m4 +++ b/m4/sys_ioctl_h.m4 @@ -1,4 +1,4 @@ -# sys_ioctl_h.m4 serial 8 +# sys_ioctl_h.m4 serial 9 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -38,7 +38,7 @@ AC_DEFUN([gl_SYS_IOCTL_H], dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include /* Some platforms declare ioctl in the wrong header. */ -#ifndef __GLIBC__ +#if !(defined __GLIBC__ && !defined __UCLIBC__) # include #endif ]], [ioctl]) diff --git a/m4/sys_select_h.m4 b/m4/sys_select_h.m4 index 95e7818fd..0e8063ea9 100644 --- a/m4/sys_select_h.m4 +++ b/m4/sys_select_h.m4 @@ -1,4 +1,4 @@ -# sys_select_h.m4 serial 14 +# sys_select_h.m4 serial 15 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -61,7 +61,7 @@ AC_DEFUN([gl_HEADER_SYS_SELECT], gl_WARN_ON_USE_PREPARE([[ /* Some systems require prerequisite headers. */ #include -#if !defined __GLIBC__ && HAVE_SYS_TIME_H +#if !(defined __GLIBC__ && !defined __UCLIBC__) && HAVE_SYS_TIME_H # include #endif #include diff --git a/m4/sys_socket_h.m4 b/m4/sys_socket_h.m4 index 9f4db5623..f10317e7a 100644 --- a/m4/sys_socket_h.m4 +++ b/m4/sys_socket_h.m4 @@ -1,4 +1,4 @@ -# sys_socket_h.m4 serial 17 +# sys_socket_h.m4 serial 18 dnl Copyright (C) 2005-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -64,7 +64,7 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], gl_WARN_ON_USE_PREPARE([[ /* Some systems require prerequisite headers. */ #include -#if !defined __GLIBC__ && HAVE_SYS_TIME_H +#if !(defined __GLIBC__ && !defined __UCLIBC__) && HAVE_SYS_TIME_H # include #endif #include diff --git a/m4/sys_times_h.m4 b/m4/sys_times_h.m4 index f60b1faa6..fc6c7e84e 100644 --- a/m4/sys_times_h.m4 +++ b/m4/sys_times_h.m4 @@ -1,5 +1,5 @@ # Configure a replacement for . -# serial 6 +# serial 7 # Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -30,7 +30,7 @@ AC_DEFUN([gl_SYS_TIMES_H], dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ /* Some systems have incomplete headers. */ -#ifndef __GLIBC__ +#if !(defined __GLIBC__ && !defined __UCLIBC__) # include #endif #include diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index 48d06c742..01dfb0481 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 46 +# unistd_h.m4 serial 47 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -27,7 +27,7 @@ AC_DEFUN([gl_UNISTD_H], dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include /* Some systems declare various items in the wrong headers. */ -#ifndef __GLIBC__ +#if !(defined __GLIBC__ && !defined __UCLIBC__) # include # include # include diff --git a/m4/wchar_h.m4 b/m4/wchar_h.m4 index 8cae82dd0..c1fc30488 100644 --- a/m4/wchar_h.m4 +++ b/m4/wchar_h.m4 @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Eric Blake. -# wchar_h.m4 serial 33 +# wchar_h.m4 serial 34 AC_DEFUN([gl_WCHAR_H], [ @@ -38,7 +38,7 @@ AC_DEFUN([gl_WCHAR_H], dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ /* Some systems require additional headers. */ -#ifndef __GLIBC__ +#if !(defined __GLIBC__ && !defined __UCLIBC__) # include # include # include diff --git a/tests/test-getopt.h b/tests/test-getopt.h index 12859ac9e..e4e6facab 100644 --- a/tests/test-getopt.h +++ b/tests/test-getopt.h @@ -21,7 +21,7 @@ /* The glibc/gnulib implementation of getopt supports setting optind = 0, but not all other implementations do. This matters for getopt. But for getopt_long, we require GNU compatibility. */ -#if defined __GETOPT_PREFIX || (__GLIBC__ >= 2) +#if defined __GETOPT_PREFIX || (__GLIBC__ >= 2 && !defined __UCLIBC__) # define OPTIND_MIN 0 #elif HAVE_DECL_OPTRESET # define OPTIND_MIN (optreset = 1) diff --git a/tests/test-sigaction.c b/tests/test-sigaction.c index 73579d960..93607dd4b 100644 --- a/tests/test-sigaction.c +++ b/tests/test-sigaction.c @@ -71,7 +71,7 @@ handler (int sig) /* This assertion fails on glibc-2.3.6 systems with LinuxThreads, when this program is linked with -lpthread, due to the sigaction() override in libpthread.so. */ -#if !defined __GLIBC__ +#if !(defined __GLIBC__ || defined __UCLIBC__) ASSERT (sa.sa_handler == SIG_DFL); #endif break; @@ -101,7 +101,7 @@ main (void) sa.sa_handler = SIG_DFL; ASSERT (sigaction (SIGABRT, &sa, &old_sa) == 0); ASSERT ((old_sa.sa_flags & SA_SIGINFO) == 0); -#if !defined __GLIBC__ /* see above */ +#if !(defined __GLIBC__ || defined __UCLIBC__) /* see above */ ASSERT (old_sa.sa_handler == SIG_DFL); #endif diff --git a/tests/test-striconveha.c b/tests/test-striconveha.c index 1da674e18..dd7eab12c 100644 --- a/tests/test-striconveha.c +++ b/tests/test-striconveha.c @@ -401,7 +401,7 @@ main () } # endif -# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 || _LIBICONV_VERSION >= 0x0105 +# if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) && !defined __UCLIBC__) || _LIBICONV_VERSION >= 0x0105 /* Test conversion from UTF-8 to ISO-8859-1 with transliteration. */ for (h = 0; h < SIZEOF (handlers); h++) { @@ -577,7 +577,7 @@ main () } # endif -# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 || _LIBICONV_VERSION >= 0x0105 +# if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) && !defined __UCLIBC__) || _LIBICONV_VERSION >= 0x0105 /* Test conversion from UTF-8 to ISO-8859-1 with transliteration. */ for (h = 0; h < SIZEOF (handlers); h++) { diff --git a/tests/test-vasnprintf-posix.c b/tests/test-vasnprintf-posix.c index c0e9ea2fa..87c58985f 100644 --- a/tests/test-vasnprintf-posix.c +++ b/tests/test-vasnprintf-posix.c @@ -3659,7 +3659,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) } #endif -#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) +#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) && !defined __UCLIBC__ /* Test that the 'I' flag is supported. */ { size_t length; diff --git a/tests/test-vasnprintf-posix3.c b/tests/test-vasnprintf-posix3.c index e0237fa60..a2e5c6825 100644 --- a/tests/test-vasnprintf-posix3.c +++ b/tests/test-vasnprintf-posix3.c @@ -32,7 +32,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) /* glibc >= 2.2 supports the 'I' flag, and in glibc >= 2.2.3 the fa_IR locale defines the 'outdigits' to be U+06F0..U+06F9. So we test for glibc >= 2.3. */ -#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) +#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__ /* Test that the 'I' flag is supported. */ { size_t length; @@ -75,7 +75,7 @@ test_asnprintf () int main (int argc, char *argv[]) { -#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) +#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__ /* Select a locale with Arabic 'outdigits'. */ if (setlocale (LC_ALL, "fa_IR.UTF-8") == NULL) { -- 2.11.0