annotate m4/strerror.m4 @ 274:3010e24bb9c5 2.5

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