diff options
author | Eric Blake <eblake@redhat.com> | 2013-03-11 14:51:33 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2013-03-11 14:51:33 -0600 |
commit | 6169015de81eaa4f8148d29abcd640b4f4ab1b56 (patch) | |
tree | 3bb88bc773f20424a653a89d59a6cd3e993062d2 /m4/frexp.m4 | |
parent | 162b3eb8ff8eca18d7c6cfbe3a4b98aa4e5972ce (diff) | |
download | gnulib-6169015de81eaa4f8148d29abcd640b4f4ab1b56.tar.gz |
regex: port to mingw's recent addition of undeclared alarm
On mingw (at least, when cross-compiling with Fedora 18's
mingw32-headers-2.0.999-0.15.trunk.20121110.fc18.noarch build),
compilation of test-regex fails:
test-regex.c: In function 'main':
test-regex.c:42:11: error: 'SIGALRM' undeclared (first use in this function)
test-regex.c:42:11: note: each undeclared identifier is reported only
once for each function it appears in
test-regex.c:43:3: warning: implicit declaration of function 'alarm'
It turns out that recent mingw64 added an export of alarm() and
SIGALRM, but guarded their declarations behind __USE_MINGW_ALARM
(default off, and with alarm() only in the non-standard <io.h>);
so the m4 tests were setting HAVE_ALARM to 1 based on link success
but then failing to compile.
* doc/posix-functions/alarm.texi (alarm): Document that alarm
exists but still doesn't work in newer mingw.
* m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Check for alarm declaration,
not existence. Ensure SIGALRM is not trapped.
* m4/mktime.m4 (gl_FUNC_MKTIME): Likewise.
* m4/regex.m4 (gl_REGEX): Likewise.
* m4/remainderf.m4 (gl_FUNC_REMAINDERF_WORKS): Likewise.
* tests/test-regex.c (main): Use correct probe for alarm.
Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'm4/frexp.m4')
-rw-r--r-- | m4/frexp.m4 | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/m4/frexp.m4 b/m4/frexp.m4 index 39097923e4..2eb98a1dcd 100644 --- a/m4/frexp.m4 +++ b/m4/frexp.m4 @@ -1,4 +1,4 @@ -# frexp.m4 serial 14 +# frexp.m4 serial 15 dnl Copyright (C) 2007-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -93,7 +93,7 @@ AC_DEFUN([gl_FUNC_FREXP_WORKS], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CHECK_FUNCS_ONCE([alarm]) + AC_CHECK_DECLS_ONCE([alarm]) AC_CACHE_CHECK([whether frexp works], [gl_cv_func_frexp_works], [ AC_RUN_IFELSE( @@ -101,7 +101,8 @@ AC_DEFUN([gl_FUNC_FREXP_WORKS], #include <float.h> #include <math.h> #include <string.h> -#if HAVE_ALARM +#if HAVE_DECL_ALARM +# include <signal.h> # include <unistd.h> #endif /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. @@ -124,9 +125,10 @@ int main() int i; volatile double x; double zero = 0.0; -#if HAVE_ALARM +#if HAVE_DECL_ALARM /* NeXTstep 3.3 frexp() runs into an endless loop when called on an infinite number. Let the test fail in this case. */ + signal (SIGALRM, SIG_DFL); alarm (5); #endif /* Test on denormalized numbers. */ |