Hi Pádraig, > > * lib/freading.h: Treat uClibc like a non-glibc platform. > > ... > > * 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. > > ...
> I noticed a slight issue with this on code inspection. > When cross-compiling for uClibc, memmem, printf, strcasestr and strstr > would be replaced, which was a change from the original. This is good and expected: - memmem in uClibc is defined by uClibc-0.9.31/libc/string/memmem.c which is an O(n²) algorithm and therefore needs to be replaced. - strstr is defined in uClibc-0.9.31/libc/string/strstr.c, also O(n²). - strcasestr is defined in uClibc-0.9.31/libc/string/strcasestr.c, also O(n²). - *printf is defined in uClibc-0.9.31/libc/stdio/_vfprintf.c or uClibc-0.9.31/libc/stdio/old_vfprintf.c, depending on the configuration, and uClibc-0.9.31/libc/stdio/_fpmaxtostr.c. In the latter code, the support of hexadecimal floats is conditional on configuration (__UCLIBC_HAS_HEXADECIMAL_FLOATS__). So in all cases the cross-compilation guesses are correct. > OK to apply the attached? Certainly not. It would add a preprocessor directive syntax error in each of the affected files. It also lacks comments and a rationale. You didn't say that you have verified that each of the versions of memmem.c in http://git.uclibc.org/uClibc/log/libc/string/memmem.c does not have the glibc bug. Likewise for http://git.uclibc.org/uClibc/log/libc/string/strstr.c http://git.uclibc.org/uClibc/log/libc/string/strcasestr.c I'm applying this modified patch instead: 2010-12-15 Pádraig Brady <p...@draigbrady.com> Bruno Haible <br...@clisp.org> Improve cross-compilation guesses for uClibc. * m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE): When cross-compiling, assume that uClibc does not have the glibc bug. * m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE): Likewise. * m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE): Likewise. --- m4/memmem.m4.orig Wed Dec 15 20:24:56 2010 +++ m4/memmem.m4 Wed Dec 15 20:18:33 2010 @@ -1,4 +1,4 @@ -# memmem.m4 serial 20 +# memmem.m4 serial 21 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 @@ -29,14 +29,17 @@ ]])], [gl_cv_func_memmem_works_always=yes], [gl_cv_func_memmem_works_always=no], - [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. Assume that it - dnl works on all other platforms, even if it is not linear. + [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not + dnl affected, since it uses different source code for memmem than + dnl glibc. + dnl Assume that it works on all other platforms, even if it is not + dnl linear. AC_EGREP_CPP([Lucky user], [ #ifdef __GNU_LIBRARY__ #include <features.h> #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ - && !defined __UCLIBC__ + || defined __UCLIBC__ Lucky user #endif #elif defined __CYGWIN__ --- m4/strcasestr.m4.orig Wed Dec 15 20:24:56 2010 +++ m4/strcasestr.m4 Wed Dec 15 20:23:39 2010 @@ -1,4 +1,4 @@ -# strcasestr.m4 serial 18 +# strcasestr.m4 serial 19 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, @@ -32,14 +32,17 @@ ]])], [gl_cv_func_strcasestr_works_always=yes], [gl_cv_func_strcasestr_works_always=no], - [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. Assume that it - dnl works on all other platforms, even if it is not linear. + [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not + dnl affected, since it uses different source code for strcasestr + dnl than glibc. + dnl Assume that it works on all other platforms, even if it is not + dnl linear. AC_EGREP_CPP([Lucky user], [ #ifdef __GNU_LIBRARY__ #include <features.h> #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ - && !defined __UCLIBC__ + || defined __UCLIBC__ Lucky user #endif #elif defined __CYGWIN__ --- m4/strstr.m4.orig Wed Dec 15 20:24:56 2010 +++ m4/strstr.m4 Wed Dec 15 20:21:00 2010 @@ -1,4 +1,4 @@ -# strstr.m4 serial 12 +# strstr.m4 serial 13 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, @@ -25,14 +25,17 @@ ]])], [gl_cv_func_strstr_works_always=yes], [gl_cv_func_strstr_works_always=no], - [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. Assume that it - dnl works on all other platforms, even if it is not linear. + [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not + dnl affected, since it uses different source code for strstr than + dnl glibc. + dnl Assume that it works on all other platforms, even if it is not + dnl linear. AC_EGREP_CPP([Lucky user], [ #ifdef __GNU_LIBRARY__ #include <features.h> #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ - && !defined __UCLIBC__ + || defined __UCLIBC__ Lucky user #endif #elif defined __CYGWIN__