annotate m4/strerror.m4 @ 437:84950ae2e2bf 3.0

Added tag 3.0 for changeset 4c272633fce2
author lost@l-w.ca
date Fri, 29 Oct 2010 19:38:14 -0600
parents b8bf63962a99
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
434
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
1 # strerror.m4 serial 9
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
2 dnl Copyright (C) 2002, 2007-2010 Free Software Foundation, Inc.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
6
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
7 AC_DEFUN([gl_FUNC_STRERROR],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
8 [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
9 AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
10 if test $REPLACE_STRERROR = 1; then
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
11 AC_LIBOBJ([strerror])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
12 AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
13 [Define this to 1 if strerror is broken.])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
14 fi
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
15 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
16
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
17 # Like gl_FUNC_STRERROR, except prepare for separate compilation (no AC_LIBOBJ).
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
18 AC_DEFUN([gl_FUNC_STRERROR_SEPARATE],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
19 [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
20 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
21 AC_REQUIRE([gl_HEADER_ERRNO_H])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
22 if test -z "$ERRNO_H"; then
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
23 AC_CACHE_CHECK([for working strerror function],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
24 [gl_cv_func_working_strerror],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
25 [AC_RUN_IFELSE(
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
26 [AC_LANG_PROGRAM(
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
27 [[#include <string.h>
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
28 ]],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
29 [[return !*strerror (-2);]])],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
30 [gl_cv_func_working_strerror=yes],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
31 [gl_cv_func_working_strerror=no],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
32 [dnl Assume crossbuild works if it compiles.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
33 AC_COMPILE_IFELSE(
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
34 [AC_LANG_PROGRAM(
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
35 [[#include <string.h>
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
36 ]],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
37 [[return !*strerror (-2);]])],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
38 [gl_cv_func_working_strerror=yes],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
39 [gl_cv_func_working_strerror=no])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
40 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
41 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
42 if test $gl_cv_func_working_strerror = no; then
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
43 dnl The system's strerror() fails to return a string for out-of-range
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
44 dnl integers. Replace it.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
45 REPLACE_STRERROR=1
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
46 fi
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
47 else
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
48 dnl The system's strerror() cannot know about the new errno values we add
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
49 dnl to <errno.h>. Replace it.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
50 REPLACE_STRERROR=1
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
51 fi
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
52 if test $REPLACE_STRERROR = 1; then
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
53 gl_PREREQ_STRERROR
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
54 fi
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
55 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
56
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
57 # Prerequisites of lib/strerror.c.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
58 AC_DEFUN([gl_PREREQ_STRERROR], [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
59 AC_CHECK_DECLS([strerror])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
60 AC_CHECK_HEADERS_ONCE([sys/socket.h])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
61 if test $ac_cv_header_sys_socket_h != yes; then
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
62 dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
63 dnl the check for those headers unconditional; yet cygwin reports
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
64 dnl that the headers are present but cannot be compiled (since on
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
65 dnl cygwin, all socket information should come from sys/socket.h).
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
66 AC_CHECK_HEADERS([winsock2.h])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
67 fi
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
68 ])