~ubuntu-branches/ubuntu/quantal/gnutls26/quantal

« back to all changes in this revision

Viewing changes to lib/gl/m4/memmem.m4

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2011-05-20 13:07:18 UTC
  • mfrom: (12.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20110520130718-db41dybbanzfvlji
Tags: 2.10.5-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Fix build failure with --no-add-needed.
  - Build for multiarch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# memmem.m4 serial 14
2
 
dnl Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
 
2
dnl Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009, 2010 Free Software
 
3
dnl Foundation, Inc.
3
4
dnl This file is free software; the Free Software Foundation
4
5
dnl gives unlimited permission to copy and/or distribute it,
5
6
dnl with or without modifications, as long as this notice is preserved.
42
43
    /* Check for quadratic performance.  */
43
44
    if (haystack && needle)
44
45
      {
45
 
        memset (haystack, 'A', 2 * m);
46
 
        haystack[2 * m] = 'B';
47
 
        memset (needle, 'A', m);
48
 
        needle[m] = 'B';
49
 
        result = memmem (haystack, 2 * m + 1, needle, m + 1);
 
46
        memset (haystack, 'A', 2 * m);
 
47
        haystack[2 * m] = 'B';
 
48
        memset (needle, 'A', m);
 
49
        needle[m] = 'B';
 
50
        result = memmem (haystack, 2 * m + 1, needle, m + 1);
50
51
      }
51
52
    /* Check for empty needle behavior.  */
52
53
    return !result || !memmem ("a", 1, 0, 0);]])],
53
 
        [gl_cv_func_memmem_works=yes], [gl_cv_func_memmem_works=no],
54
 
        [dnl Only glibc >= 2.9 and cygwin >= 1.7.0 are known to have a
55
 
         dnl memmem that works in linear time.
56
 
         AC_EGREP_CPP([Lucky user],
57
 
           [
 
54
        [gl_cv_func_memmem_works=yes], [gl_cv_func_memmem_works=no],
 
55
        [dnl Only glibc >= 2.9 and cygwin >= 1.7.0 are known to have a
 
56
         dnl memmem that works in linear time.
 
57
         AC_EGREP_CPP([Lucky user],
 
58
           [
58
59
#include <features.h>
59
60
#ifdef __GNU_LIBRARY__
60
61
 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 9) || (__GLIBC__ > 2)
67
68
  Lucky user
68
69
 #endif
69
70
#endif
70
 
           ],
71
 
           [gl_cv_func_memmem_works=yes],
72
 
           [gl_cv_func_memmem_works="guessing no"])
73
 
        ])
 
71
           ],
 
72
           [gl_cv_func_memmem_works=yes],
 
73
           [gl_cv_func_memmem_works="guessing no"])
 
74
        ])
74
75
      ])
75
76
    if test "$gl_cv_func_memmem_works" != yes; then
76
77
      REPLACE_MEMMEM=1