Mercurial > hg > octave-lojdl > gnulib-hg
annotate m4/perl.m4 @ 15308:a3ba680ad389
strerror_r: fix OpenBSD behavior on 0
OpenBSD treats strerror_r(0,,) as a success, but with a message
"Undefined error: 0"; while this is distinct from strerror_r(-1,,)
returning "Unknown error: -1", it does not imply success. Meanwhile,
if buf is short enough for ERANGE, then we can't use strstr to look
for "Unknown" or "Undefined" in the resulting message, like we had
been doing for strerror(). Fix this by shifting the burden - now
the strerror-override code guarantees that 0 will have an
override when needed.
* lib/strerror-override.c (strerror_override): Also override 0
when needed.
* lib/strerror-override.h (strerror_override): Likewise.
* lib/strerror.c (strerror): Simplify, now that 0 override is done
earlier.
* lib/strerror_r.c (strerror_r): Likewise.
* m4/strerror.m4 (gl_FUNC_STRERROR): Split detection of 0
behavior...
(gl_FUNC_STRERROR_0): ...into new macro.
* m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Replace strerror_r if 0
is overridden.
(gl_FUNC_STRERROR_R_WORKS): Avoid extra tests if 0 is broken.
* modules/strerror-override (Files): Add strerror.m4.
(configure.ac): Also provide override for 0 when needed.
* doc/posix-functions/strerror.texi (strerror): Document this.
* doc/posix-functions/perror.texi (perror): Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
author | Eric Blake <eblake@redhat.com> |
---|---|
date | Tue, 21 Jun 2011 08:50:51 -0600 |
parents | 97fc9a21a8fb |
children | 8250f2777afc |
rev | line source |
---|---|
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
8226
diff
changeset
|
1 # serial 9 |
1232 | 2 |
3 dnl From Jim Meyering. | |
4 dnl Find a new-enough version of Perl. | |
5 | |
14079
97fc9a21a8fb
maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents:
12559
diff
changeset
|
6 # Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2011 Free Software Foundation, |
12559
c2cbabec01dd
update nearly all FSF copyright year lists to include 2010
Jim Meyering <meyering@redhat.com>
parents:
11007
diff
changeset
|
7 # Inc. |
5611
87c42e194f4a
Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
8 # |
87c42e194f4a
Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
9 # This file is free software; the Free Software Foundation |
87c42e194f4a
Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
10 # gives unlimited permission to copy and/or distribute it, |
87c42e194f4a
Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
11 # with or without modifications, as long as this notice is preserved. |
87c42e194f4a
Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
12 |
5016
7141ea4946af
Change jm_ to gl_ in AC_DEFINE'd names. Update all uses.
Jim Meyering <jim@meyering.net>
parents:
4569
diff
changeset
|
13 AC_DEFUN([gl_PERL], |
1232 | 14 [ |
8226
a02426de7f27
* m4/perl.m4 (gl_PERL): Require version 5.005, not 5.003.
Jim Meyering <jim@meyering.net>
parents:
5611
diff
changeset
|
15 dnl FIXME: don't hard-code 5.005 |
a02426de7f27
* m4/perl.m4 (gl_PERL): Require version 5.005, not 5.003.
Jim Meyering <jim@meyering.net>
parents:
5611
diff
changeset
|
16 AC_MSG_CHECKING([for perl5.005 or newer]) |
1232 | 17 if test "${PERL+set}" = set; then |
18 # `PERL' is set in the user's environment. | |
19 candidate_perl_names="$PERL" | |
20 perl_specified=yes | |
21 else | |
22 candidate_perl_names='perl perl5' | |
23 perl_specified=no | |
24 fi | |
25 | |
26 found=no | |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
8226
diff
changeset
|
27 AC_SUBST([PERL]) |
4569
614d9c5788fc
(jm_PERL): Use $am_missing_run, not undefined $missing_dir.
Paul Eggert <eggert@cs.ucla.edu>
parents:
3339
diff
changeset
|
28 PERL="$am_missing_run perl" |
1232 | 29 for perl in $candidate_perl_names; do |
30 # Run test in a subshell; some versions of sh will print an error if | |
31 # an executable is not found, even if stderr is redirected. | |
8226
a02426de7f27
* m4/perl.m4 (gl_PERL): Require version 5.005, not 5.003.
Jim Meyering <jim@meyering.net>
parents:
5611
diff
changeset
|
32 if ( $perl -e 'require 5.005; use File::Compare' ) > /dev/null 2>&1; then |
1232 | 33 PERL=$perl |
34 found=yes | |
35 break | |
36 fi | |
37 done | |
38 | |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
8226
diff
changeset
|
39 AC_MSG_RESULT([$found]) |
1232 | 40 test $found = no && AC_MSG_WARN([ |
8226
a02426de7f27
* m4/perl.m4 (gl_PERL): Require version 5.005, not 5.003.
Jim Meyering <jim@meyering.net>
parents:
5611
diff
changeset
|
41 WARNING: You don't seem to have perl5.005 or newer installed, or you lack |
2220
fc54f4397088
Change format of warning message to look more like that
Jim Meyering <jim@meyering.net>
parents:
2026
diff
changeset
|
42 a usable version of the Perl File::Compare module. As a result, |
fc54f4397088
Change format of warning message to look more like that
Jim Meyering <jim@meyering.net>
parents:
2026
diff
changeset
|
43 you may be unable to run a few tests or to regenerate certain |
fc54f4397088
Change format of warning message to look more like that
Jim Meyering <jim@meyering.net>
parents:
2026
diff
changeset
|
44 files if you modify the sources from which they are derived. |
2026
e75e04d6e0a0
Require that File::Compare be available, too.
Jim Meyering <jim@meyering.net>
parents:
1232
diff
changeset
|
45 ] ) |
1232 | 46 ]) |