Mercurial > hg > octave-nkf > gnulib-hg
changeset 17308:19e841152153
regex: avoid infinite configure test
At least glibc 2.15 on Ubuntu ended up hanging.
* m4/regex.m4 (gl_REGEX): Add an alarm escape hatch.
Reported by Reuben Thomas.
Signed-off-by: Eric Blake <eblake@redhat.com>
author | Eric Blake <eblake@redhat.com> |
---|---|
date | Thu, 31 Jan 2013 15:57:38 -0700 |
parents | d2ccaec7b18c |
children | 4894f045fd01 |
files | ChangeLog m4/regex.m4 |
diffstat | 2 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-01-31 Eric Blake <eblake@redhat.com> + + regex: avoid infinite configure test + * m4/regex.m4 (gl_REGEX): Add an alarm escape hatch. + 2013-01-31 Reuben Thomas <rrt@sc3d.org> openpty: fix bug where HAVE_OPENPTY wasn't defined
--- a/m4/regex.m4 +++ b/m4/regex.m4 @@ -1,4 +1,4 @@ -# serial 62 +# serial 63 # Copyright (C) 1996-2001, 2003-2013 Free Software Foundation, Inc. # @@ -27,6 +27,7 @@ # following run test, then default to *not* using the included regex.c. # If cross compiling, assume the test would fail and use the included # regex.c. + AC_CHECK_FUNCS_ONCE([alarm]) AC_CACHE_CHECK([for working re_compile_pattern], [gl_cv_func_re_compile_pattern_working], [AC_RUN_IFELSE( @@ -35,6 +36,10 @@ #include <locale.h> #include <limits.h> #include <regex.h> + #if HAVE_ALARM + # include <unistd.h> + # include <signal.h> + #endif ]], [[int result = 0; static struct re_pattern_buffer regex; @@ -43,6 +48,11 @@ const char *s; struct re_registers regs; +#if HAVE_ALARM + /* Some builds of glibc go into an infinite loop on this test. */ + signal (SIGALRM, SIG_DFL); + alarm (2); +#endif if (setlocale (LC_ALL, "en_US.UTF-8")) { {