bug-gnulib
[Top][All Lists]
Advanced

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

Re: __GLIBC__ and uClibc


From: Bruno Haible
Subject: Re: __GLIBC__ and uClibc
Date: Sat, 20 Nov 2010 19:15:48 +0100
User-agent: KMail/1.9.9

Yesterday I wrote:
> Oh, you're talking about uClibc, not glibc! That's a different platform than
> glibc.
>   - It has a very different FILE structure in <stdio.h>.
>   - It sometimes has no <wchar.h>, depending how it was configured.
>   - Its <features.h> file sometimes defines __GLIBC__ and sometimes doesn't,
>     depending whether __FORCE_NOGLIBC or __FORCE_GLIBC is defined.
>   - It doesn't have all the functions that glibc has.
> 
> gnulib needs to treat this differently than glibc platforms
>   1. because it's not glibc,
>   2. because you can't reliably test for the presence of __GLIBC__ on this
>      platform.
> ...
> I'll review all uses of __GLIBC__ in gnulib tomorrow.

Mike Frysinger writes:
> uclibc defines __GLIBC__

More exactly, uClibc *usually* defines __GLIBC__, but not always.

Most of the good features of glibc are not contained in uClibc, or can be
turned off during the configuration of uClibc. Therefore, in general uClibc
has to be treated like a different platform.

   +------------------------------------------------------+
   | When we mean to test for glibc, we now have to write |
   |   #if defined __GLIBC__ && !defined __UCLIBC__       |
   | instead of                                           |
   |   #if defined __GLIBC__                              |
   +------------------------------------------------------+

Whereas when uClibc can be treated the same way as glibc, we have to write
   #if defined __GLIBC__ || defined __UCLIBC__
instead of
   #if defined __GLIBC__

uClibc also usually defines __GLIBC_MINOR__ to 2, but I think it's better
to not rely on that. I can easily imagine them to bump that to 5, 8, or 12
at some point in time without actually incorporating the bug fixes from
glibc 2.5 or 2.8 or 2.12.


I'm applying this. In some cases (like in m4/unistd_h.m4) it would be possible
to slightly improve the test for uClibc, assume one has built a minimal uClibc
and a maximal uClibc and verified the result of a test program in both cases.
I'm instead putting in a pessimistic guess. This will not require us to track
future uClibc changes. (We are constantly tracking new glibc releases only.)

Feel free to improve on it when you have time and dedication.


2010-11-20  Bruno Haible  <address@hidden>

        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 <address@hidden>.

--- doc/posix-functions/getdelim.texi.orig      Sat Nov 20 18:19:09 2010
+++ doc/posix-functions/getdelim.texi   Sat Nov 20 16:52:51 2010
@@ -22,4 +22,7 @@
 
 Portability problems not fixed by Gnulib:
 @itemize
address@hidden
+This function has quadratic running time for long lines on some platforms:
+uClibc 0.9.31.
 @end itemize
--- doc/posix-functions/getline.texi.orig       Sat Nov 20 18:19:09 2010
+++ doc/posix-functions/getline.texi    Sat Nov 20 16:52:46 2010
@@ -25,4 +25,7 @@
 
 Portability problems not fixed by Gnulib:
 @itemize
address@hidden
+This function has quadratic running time for long lines on some platforms:
+uClibc 0.9.31.
 @end itemize
--- lib/localename.c.orig       Sat Nov 20 18:19:09 2010
+++ lib/localename.c    Sat Nov 20 17:36:31 2010
@@ -2607,7 +2607,7 @@
     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 @@
    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
 
--- lib/propername.c.orig       Sat Nov 20 18:19:10 2010
+++ lib/propername.c    Sat Nov 20 14:25:25 2010
@@ -198,7 +198,8 @@
       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;
--- lib/relocatable.c.orig      Sat Nov 20 18:19:10 2010
+++ lib/relocatable.c   Sat Nov 20 17:18:14 2010
@@ -344,8 +344,9 @@
 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.  */
--- lib/spawn.in.h.orig Sat Nov 20 18:19:10 2010
+++ lib/spawn.in.h      Sat Nov 20 14:25:58 2010
@@ -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
--- lib/strerror_r.c.orig       Sat Nov 20 18:19:10 2010
+++ lib/strerror_r.c    Sat Nov 20 14:37:58 2010
@@ -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 @@
   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 @@
   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"
 
--- lib/striconv.c.orig Sat Nov 20 18:19:10 2010
+++ lib/striconv.c      Sat Nov 20 18:16:35 2010
@@ -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 @@
 
   /* 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 @@
             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 @@
       }
     /* 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 @@
 
   /* 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 @@
             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 @@
       }
     /* 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 @@
      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 @@
 
   /* 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 @@
       }
     /* 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 @@
       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)
         {
--- lib/striconveh.c.orig       Sat Nov 20 18:19:10 2010
+++ lib/striconveh.c    Sat Nov 20 18:18:57 2010
@@ -52,7 +52,8 @@
   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 @@
     }
 
   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 @@
 /* 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 @@
 
   *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 @@
 
     /* 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 @@
   /* 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 @@
 
     /* 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 @@
             /* 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 @@
                     /* 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 @@
                               }
                             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.
--- lib/striconveha.c.orig      Sat Nov 20 18:19:10 2010
+++ lib/striconveha.c   Sat Nov 20 18:17:43 2010
@@ -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 @@
 
   /* 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 @@
 
   /* 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;
--- lib/string.in.h.orig        Sat Nov 20 18:19:10 2010
+++ lib/string.in.h     Sat Nov 20 17:38:57 2010
@@ -87,7 +87,7 @@
                         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_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_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_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_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 @@
                         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 @@
                         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 *,
--- lib/unicodeio.c.orig        Sat Nov 20 18:19:10 2010
+++ lib/unicodeio.c     Sat Nov 20 18:14:40 2010
@@ -140,7 +140,9 @@
 
       /* 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);
--- m4/arpa_inet_h.m4.orig      Sat Nov 20 18:19:10 2010
+++ m4/arpa_inet_h.m4   Sat Nov 20 18:01:24 2010
@@ -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 @@
   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 <sys/socket.h>
 #endif
 #include <arpa/inet.h>
--- m4/duplocale.m4.orig        Sat Nov 20 18:19:10 2010
+++ m4/duplocale.m4     Sat Nov 20 14:18:25 2010
@@ -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 @@
 }]])],
          [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 <features.h>
 #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"])
--- m4/fsusage.m4.orig  Sat Nov 20 18:19:10 2010
+++ m4/fsusage.m4       Sat Nov 20 14:20:20 2010
@@ -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 @@
   # 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 <sys/types.h>
-#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.
--- m4/getdelim.m4.orig Sat Nov 20 18:19:10 2010
+++ m4/getdelim.m4      Sat Nov 20 16:51:12 2010
@@ -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 @@
          [
 #include <features.h>
 #ifdef __GNU_LIBRARY__
- #if (__GLIBC__ >= 2)
+ #if (__GLIBC__ >= 2) && !defined __UCLIBC__
   Lucky GNU user
  #endif
 #endif
--- m4/getline.m4.orig  Sat Nov 20 18:19:10 2010
+++ m4/getline.m4       Sat Nov 20 16:53:31 2010
@@ -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 @@
          [
 #include <features.h>
 #ifdef __GNU_LIBRARY__
- #if (__GLIBC__ >= 2)
+ #if (__GLIBC__ >= 2) && !defined __UCLIBC__
   Lucky GNU user
  #endif
 #endif
--- m4/glibc2.m4.orig   Sat Nov 20 18:19:10 2010
+++ m4/glibc2.m4        Sat Nov 20 18:02:50 2010
@@ -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 @@
         [
 #include <features.h>
 #ifdef __GNU_LIBRARY__
- #if (__GLIBC__ >= 2)
+ #if (__GLIBC__ >= 2) && !defined __UCLIBC__
   Lucky GNU user
  #endif
 #endif
--- m4/glibc21.m4.orig  Sat Nov 20 18:19:10 2010
+++ m4/glibc21.m4       Sat Nov 20 18:12:18 2010
@@ -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 <features.h>
 #ifdef __GNU_LIBRARY__
@@ -19,6 +19,9 @@
   Lucky GNU user
  #endif
 #endif
+#ifdef __UCLIBC__
+ Lucky user
+#endif
         ],
         [ac_cv_gnu_library_2_1=yes],
         [ac_cv_gnu_library_2_1=no])
--- m4/iconv_open.m4.orig       Sat Nov 20 18:19:10 2010
+++ m4/iconv_open.m4    Sat Nov 20 16:59:35 2010
@@ -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 @@
     dnl We know that GNU libiconv and GNU libc do.
     AC_EGREP_CPP([gnu_iconv], [
       #include <iconv.h>
-      #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])
--- m4/memmem.m4.orig   Sat Nov 20 18:19:10 2010
+++ m4/memmem.m4        Sat Nov 20 18:13:00 2010
@@ -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 @@
            [
 #ifdef __GNU_LIBRARY__
  #include <features.h>
- #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 @@
            [
 #include <features.h>
 #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
--- m4/printf.m4.orig   Sat Nov 20 18:19:10 2010
+++ m4/printf.m4        Sat Nov 20 14:39:32 2010
@@ -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 @@
              AC_EGREP_CPP([BZ2908], [
                #include <features.h>
                #ifdef __GNU_LIBRARY__
-                #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)
+                #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 
2)) && !defined __UCLIBC__
                  BZ2908
                 #endif
                #endif
--- m4/strcasestr.m4.orig       Sat Nov 20 18:19:10 2010
+++ m4/strcasestr.m4    Sat Nov 20 18:13:24 2010
@@ -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 @@
              [
 #ifdef __GNU_LIBRARY__
  #include <features.h>
- #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 @@
            [
 #include <features.h>
 #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
--- m4/strstr.m4.orig   Sat Nov 20 18:19:10 2010
+++ m4/strstr.m4        Sat Nov 20 18:13:42 2010
@@ -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 @@
            [
 #ifdef __GNU_LIBRARY__
  #include <features.h>
- #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 @@
            [
 #include <features.h>
 #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
--- m4/strtod.m4.orig   Sat Nov 20 18:19:10 2010
+++ m4/strtod.m4        Sat Nov 20 18:13:52 2010
@@ -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 @@
            [
 #include <features.h>
 #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
--- m4/sys_ioctl_h.m4.orig      Sat Nov 20 18:19:11 2010
+++ m4/sys_ioctl_h.m4   Sat Nov 20 17:04:27 2010
@@ -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 @@
   dnl corresponding gnulib module is not in use.
   gl_WARN_ON_USE_PREPARE([[#include <sys/ioctl.h>
 /* Some platforms declare ioctl in the wrong header.  */
-#ifndef __GLIBC__
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
 # include <unistd.h>
 #endif
     ]], [ioctl])
--- m4/sys_select_h.m4.orig     Sat Nov 20 18:19:11 2010
+++ m4/sys_select_h.m4  Sat Nov 20 17:05:14 2010
@@ -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 @@
   gl_WARN_ON_USE_PREPARE([[
 /* Some systems require prerequisite headers.  */
 #include <sys/types.h>
-#if !defined __GLIBC__ && HAVE_SYS_TIME_H
+#if !(defined __GLIBC__ && !defined __UCLIBC__) && HAVE_SYS_TIME_H
 # include <sys/time.h>
 #endif
 #include <sys/select.h>
--- m4/sys_socket_h.m4.orig     Sat Nov 20 18:19:11 2010
+++ m4/sys_socket_h.m4  Sat Nov 20 17:06:08 2010
@@ -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 @@
   gl_WARN_ON_USE_PREPARE([[
 /* Some systems require prerequisite headers.  */
 #include <sys/types.h>
-#if !defined __GLIBC__ && HAVE_SYS_TIME_H
+#if !(defined __GLIBC__ && !defined __UCLIBC__) && HAVE_SYS_TIME_H
 # include <sys/time.h>
 #endif
 #include <sys/select.h>
--- m4/sys_times_h.m4.orig      Sat Nov 20 18:19:11 2010
+++ m4/sys_times_h.m4   Sat Nov 20 17:06:55 2010
@@ -1,5 +1,5 @@
 # Configure a replacement for <sys/times.h>.
-# 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 @@
   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 <time.h>
 #endif
 #include <sys/times.h>
--- m4/unistd_h.m4.orig Sat Nov 20 18:19:11 2010
+++ m4/unistd_h.m4      Sat Nov 20 17:08:10 2010
@@ -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 @@
   dnl corresponding gnulib module is not in use.
   gl_WARN_ON_USE_PREPARE([[#include <unistd.h>
 /* Some systems declare various items in the wrong headers.  */
-#ifndef __GLIBC__
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
 # include <fcntl.h>
 # include <stdio.h>
 # include <stdlib.h>
--- m4/wchar_h.m4.orig  Sat Nov 20 18:19:11 2010
+++ m4/wchar_h.m4       Sat Nov 20 17:08:50 2010
@@ -7,7 +7,7 @@
 
 dnl Written by Eric Blake.
 
-# wchar_h.m4 serial 33
+# wchar_h.m4 serial 34
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -38,7 +38,7 @@
   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 <stddef.h>
 # include <stdio.h>
 # include <time.h>
--- tests/test-getopt.h.orig    Sat Nov 20 18:19:11 2010
+++ tests/test-getopt.h Sat Nov 20 14:30:16 2010
@@ -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)
--- tests/test-sigaction.c.orig Sat Nov 20 18:19:11 2010
+++ tests/test-sigaction.c      Sat Nov 20 14:32:40 2010
@@ -71,7 +71,7 @@
       /* 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 @@
   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
 
--- tests/test-striconveha.c.orig       Sat Nov 20 18:19:11 2010
+++ tests/test-striconveha.c    Sat Nov 20 14:33:39 2010
@@ -401,7 +401,7 @@
     }
 # 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 @@
     }
 # 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++)
     {



reply via email to

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