Some systems might have SIGALRM blocked when running configure. If that is the case, the nanosleep() test will sleep for practically ever as the signal generated by alarm() is never delivered. As such, we should make sure to unblock SIGALRM before running any tests.
This crops up from time to time on Linux systems (google for "SIGALRM blocked" for examples). Not sure if the m4 files need to depend on some other signal checks ... Signed-off-by: Mike Frysinger <vap...@gentoo.org> --- m4/mktime.m4 | 6 +++++- m4/nanosleep.m4 | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/m4/mktime.m4 b/m4/mktime.m4 index 1e926e8..f261265 100644 --- a/m4/mktime.m4 +++ b/m4/mktime.m4 @@ -1,4 +1,4 @@ -# serial 15 +# serial 16 dnl Copyright (C) 2002-2003, 2005-2007, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -170,6 +170,10 @@ main () /* This test makes some buggy mktime implementations loop. Give up after 60 seconds; a mktime slower than that isn't worth using anyway. */ + sigset_t set; + sigemptyset (&set); + sigaddset (&set, SIGALRM); + sigprocmask (SIG_UNBLOCK, &set, NULL); alarm (60); for (;;) diff --git a/m4/nanosleep.m4 b/m4/nanosleep.m4 index 7f08744..d727e19 100644 --- a/m4/nanosleep.m4 +++ b/m4/nanosleep.m4 @@ -1,4 +1,4 @@ -# serial 27 +# serial 28 dnl From Jim Meyering. dnl Check for the nanosleep function. @@ -69,6 +69,10 @@ AC_DEFUN([gl_FUNC_NANOSLEEP], static struct timespec ts_sleep; static struct timespec ts_remaining; static struct sigaction act; + static sigset_t set; + sigemptyset (&set); + sigaddset (&set, SIGALRM); + sigprocmask (SIG_UNBLOCK, &set, NULL); if (! nanosleep) return 1; act.sa_handler = check_for_SIGALRM; -- 1.6.3