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

« back to all changes in this revision

Viewing changes to m4/strerror.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
 
# strerror.m4 serial 9
2
 
dnl Copyright (C) 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
 
1
# strerror.m4 serial 16
 
2
dnl Copyright (C) 2002, 2007-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.
6
6
 
7
7
AC_DEFUN([gl_FUNC_STRERROR],
8
8
[
9
 
  AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE])
10
 
  if test $REPLACE_STRERROR = 1; then
11
 
    AC_LIBOBJ([strerror])
12
 
    AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR],
13
 
      [Define this to 1 if strerror is broken.])
14
 
  fi
15
 
])
16
 
 
17
 
# Like gl_FUNC_STRERROR, except prepare for separate compilation (no AC_LIBOBJ).
18
 
AC_DEFUN([gl_FUNC_STRERROR_SEPARATE],
19
 
[
20
9
  AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
21
10
  AC_REQUIRE([gl_HEADER_ERRNO_H])
22
 
  if test -z "$ERRNO_H"; then
 
11
  AC_REQUIRE([gl_FUNC_STRERROR_0])
 
12
  m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [
 
13
    AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS])
 
14
  ])
 
15
  if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then
23
16
    AC_CACHE_CHECK([for working strerror function],
24
17
     [gl_cv_func_working_strerror],
25
18
     [AC_RUN_IFELSE(
26
19
        [AC_LANG_PROGRAM(
27
20
           [[#include <string.h>
28
21
           ]],
29
 
           [[return !*strerror (-2);]])],
 
22
           [[if (!*strerror (-2)) return 1;]])],
30
23
        [gl_cv_func_working_strerror=yes],
31
24
        [gl_cv_func_working_strerror=no],
32
 
        [dnl Assume crossbuild works if it compiles.
33
 
         AC_COMPILE_IFELSE(
34
 
           [AC_LANG_PROGRAM(
35
 
              [[#include <string.h>
36
 
              ]],
37
 
              [[return !*strerror (-2);]])],
38
 
           [gl_cv_func_working_strerror=yes],
39
 
           [gl_cv_func_working_strerror=no])
40
 
      ])
 
25
        [dnl Be pessimistic on cross-compiles for now.
 
26
         gl_cv_func_working_strerror="guessing no"])
41
27
    ])
42
 
    if test $gl_cv_func_working_strerror = no; then
 
28
    if test "$gl_cv_func_working_strerror" != yes; then
43
29
      dnl The system's strerror() fails to return a string for out-of-range
44
30
      dnl integers. Replace it.
45
31
      REPLACE_STRERROR=1
46
32
    fi
 
33
    m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [
 
34
      dnl If the system's strerror_r or __xpg_strerror_r clobbers strerror's
 
35
      dnl buffer, we must replace strerror.
 
36
      case "$gl_cv_func_strerror_r_works" in
 
37
        *no) REPLACE_STRERROR=1 ;;
 
38
      esac
 
39
    ])
47
40
  else
48
41
    dnl The system's strerror() cannot know about the new errno values we add
49
 
    dnl to <errno.h>. Replace it.
 
42
    dnl to <errno.h>, or any fix for strerror(0). Replace it.
50
43
    REPLACE_STRERROR=1
51
44
  fi
52
 
  if test $REPLACE_STRERROR = 1; then
53
 
    gl_PREREQ_STRERROR
54
 
  fi
55
45
])
56
46
 
57
 
# Prerequisites of lib/strerror.c.
58
 
AC_DEFUN([gl_PREREQ_STRERROR], [
59
 
  AC_CHECK_DECLS([strerror])
60
 
  AC_CHECK_HEADERS_ONCE([sys/socket.h])
61
 
  if test $ac_cv_header_sys_socket_h != yes; then
62
 
    dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
63
 
    dnl the check for those headers unconditional; yet cygwin reports
64
 
    dnl that the headers are present but cannot be compiled (since on
65
 
    dnl cygwin, all socket information should come from sys/socket.h).
66
 
    AC_CHECK_HEADERS([winsock2.h])
 
47
dnl Detect if strerror(0) passes (that is, does not set errno, and does not
 
48
dnl return a string that matches strerror(-1)).
 
49
AC_DEFUN([gl_FUNC_STRERROR_0],
 
50
[
 
51
  REPLACE_STRERROR_0=0
 
52
  AC_CACHE_CHECK([whether strerror(0) succeeds],
 
53
   [gl_cv_func_strerror_0_works],
 
54
   [AC_RUN_IFELSE(
 
55
      [AC_LANG_PROGRAM(
 
56
         [[#include <string.h>
 
57
           #include <errno.h>
 
58
         ]],
 
59
         [[int result = 0;
 
60
           char *str;
 
61
           errno = 0;
 
62
           str = strerror (0);
 
63
           if (!*str) result |= 1;
 
64
           if (errno) result |= 2;
 
65
           if (strstr (str, "nknown") || strstr (str, "ndefined"))
 
66
             result |= 4;
 
67
           return result;]])],
 
68
      [gl_cv_func_strerror_0_works=yes],
 
69
      [gl_cv_func_strerror_0_works=no],
 
70
      [dnl Be pessimistic on cross-compiles for now.
 
71
       gl_cv_func_strerror_0_works="guessing no"])
 
72
  ])
 
73
  if test "$gl_cv_func_strerror_0_works" != yes; then
 
74
    REPLACE_STRERROR_0=1
 
75
    AC_DEFINE([REPLACE_STRERROR_0], [1], [Define to 1 if strerror(0)
 
76
      does not return a message implying success.])
67
77
  fi
68
78
])