~ubuntu-branches/ubuntu/precise/wget/precise-proposed

« back to all changes in this revision

Viewing changes to m4/memchr.m4

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2011-10-19 00:00:09 UTC
  • mfrom: (2.1.13 sid)
  • Revision ID: james.westby@ubuntu.com-20111019000009-8p33w3wz4b1rdri0
Tags: 1.13-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add wget-udeb to ship wget.gnu as alternative to busybox wget
    implementation.
  - Depend on libssl-dev 0.9.8k-7ubuntu4 (LP: #503339)
* Dropped changes, superseded in Debian:
  - Keep build dependencies in main:
    + debian/control: remove info2man build-dep
    + debian/patches/series: disable wget-infopod_generated_manpage
  - Mark wget Multi-Arch: foreign, so packages that aren't of the same arch
    can depend on it.
* Pass --with-ssl=openssl; we don't want to use gnutls, there's no udeb for
  it.
* Add a second build pass for the udeb, so we can build without libidn.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# memchr.m4 serial 7
2
 
dnl Copyright (C) 2002, 2003, 2004, 2009 Free Software Foundation, Inc.
 
1
# memchr.m4 serial 12
 
2
dnl Copyright (C) 2002-2004, 2009-2011 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
11
11
  AC_CHECK_HEADERS_ONCE([sys/mman.h])
12
12
  AC_CHECK_FUNCS_ONCE([mprotect])
13
13
 
14
 
  dnl These days, we assume memchr is present.  But just in case...
15
14
  AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
16
 
  AC_REPLACE_FUNCS([memchr])
17
 
  if test $ac_cv_func_memchr = no; then
18
 
    gl_PREREQ_MEMCHR
19
 
    REPLACE_MEMCHR=1
20
 
  fi
21
 
 
22
 
  if test $ac_cv_func_memchr = yes; then
 
15
  m4_ifdef([gl_FUNC_MEMCHR_OBSOLETE], [
 
16
    dnl These days, we assume memchr is present.  But if support for old
 
17
    dnl platforms is desired:
 
18
    AC_CHECK_FUNCS_ONCE([memchr])
 
19
    if test $ac_cv_func_memchr = no; then
 
20
      HAVE_MEMCHR=0
 
21
    fi
 
22
  ])
 
23
  if test $HAVE_MEMCHR = 1; then
23
24
    # Detect platform-specific bugs in some versions of glibc:
24
25
    # memchr should not dereference anything with length 0
25
26
    #   http://bugzilla.redhat.com/499689
40
41
# endif
41
42
#endif
42
43
]], [[
 
44
  int result = 0;
43
45
  char *fence = NULL;
44
46
#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
45
47
# if HAVE_MAP_ANONYMOUS
53
55
    {
54
56
      int pagesize = getpagesize ();
55
57
      char *two_pages =
56
 
        (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
57
 
                       flags, fd, 0);
 
58
        (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
 
59
                       flags, fd, 0);
58
60
      if (two_pages != (char *)(-1)
59
 
          && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
60
 
        fence = two_pages + pagesize;
 
61
          && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
 
62
        fence = two_pages + pagesize;
61
63
    }
62
64
#endif
63
65
  if (fence)
64
66
    {
65
67
      if (memchr (fence, 0, 0))
66
 
        return 1;
 
68
        result |= 1;
67
69
      strcpy (fence - 9, "12345678");
68
70
      if (memchr (fence - 9, 0, 79) != fence - 1)
69
 
        return 2;
 
71
        result |= 2;
 
72
      if (memchr (fence - 1, 0, 3) != fence - 1)
 
73
        result |= 4;
70
74
    }
71
 
  return 0;
 
75
  return result;
72
76
]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no],
73
77
      [dnl Be pessimistic for now.
74
78
       gl_cv_func_memchr_works="guessing no"])])
75
79
    if test "$gl_cv_func_memchr_works" != yes; then
76
 
      gl_PREREQ_MEMCHR
77
80
      REPLACE_MEMCHR=1
78
 
      AC_LIBOBJ([memchr])
79
81
    fi
80
82
  fi
81
83
])