-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Mike Frysinger on 5/18/2009 9:11 PM:
> 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.

Thanks for the report.

> @@ -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);

This won't work on platforms that have signal() but not sigprocmask().
Let's just reuse the test already present in other timeout situations,
such as in m4/strstr.m4.

...
    [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h> /* for signal */
#include <string.h> /* for memmem */
#include <stdlib.h> /* for malloc */
#include <unistd.h> /* for alarm */
]], [[size_t m = 1000000;
    char *haystack = (char *) malloc (2 * m + 2);
    char *needle = (char *) malloc (m + 2);
    void *result = 0;
    /* Failure to compile this test due to missing alarm is okay,
       since all such platforms (mingw) also have quadratic strstr.  */
    signal (SIGALRM, SIG_DFL);
    alarm (5);
...

We also need to make sure the test still gives the correct results on
mingw, which lacks alarm().

- --
Don't work too hard, make some time for fun as well!

Eric Blake             e...@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkoSKaUACgkQ84KuGfSFAYCwKgCgpEEeAAtZI/WeiYT2b1VIkJwi
duQAn1NoT7fs/FCaFV/aQwqEOGzVb8ug
=ZldQ
-----END PGP SIGNATURE-----


Reply via email to