Mercurial > hg > octave-lyh > gnulib-hg
changeset 13918:d5a74c6ec06b
Put more information about failed tests into the test return codes.
* m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Change test
program so that it returns an enumerated value (0, 1, 2, 3, 4, ...).
* m4/d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): Likewise.
* m4/getcwd-path-max.m4 (gl_FUNC_GETCWD_PATH_MAX): Likewise.
* m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): Likewise.
* m4/getdelim.m4 (gl_FUNC_GETDELIM): Likewise.
* m4/getline.m4 (gl_FUNC_GETLINE): Likewise.
* m4/intdiv0.m4 (gt_INTDIV0): Likewise.
* m4/isapipe.m4 (gl_PREREQ_ISAPIPE): Likewise.
* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Likewise.
* m4/posix_spawn.m4 (gl_POSIX_SPAWN_WORKS): Likewise.
* m4/putenv.m4 (gl_FUNC_PUTENV): Likewise.
* m4/sleep.m4 (gl_FUNC_SLEEP): Likewise.
* m4/stdint.m4 (gl_STDINT_H): Likewise.
* m4/calloc.m4 (_AC_FUNC_CALLOC_IF): Change test program so that it
returns a bit mask.
* m4/canonicalize.m4 (gl_FUNC_REALPATH_WORKS): Likewise.
* m4/chown.m4 (gl_FUNC_CHOWN_FOLLOWS_SYMLINK): Likewise.
* m4/dup2.m4 (gl_FUNC_DUP2): Likewise.
* m4/fcntl-o.m4 (gl_FCNTL_O_FLAGS): Likewise.
* m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Likewise.
* m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Likewise.
* m4/frexpl.m4 (gl_FUNC_FREXPL_WORKS): Likewise.
* m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Likewise.
* m4/iconv.m4 (AM_ICONV_LINK): Likewise.
* m4/iconv_open.m4 (gl_FUNC_ICONV_OPEN_UTF): Likewise.
* m4/isfinite.m4 (gl_ISFINITEL_WORKS): Likewise.
* m4/isnanf.m4 (gl_ISNANF_WORKS): Likewise.
* m4/isnanl.m4 (gl_FUNC_ISNANL_WORKS): Likewise.
* m4/ldexpl.m4 (gl_FUNC_LDEXPL_WORKS): Likewise.
* m4/link.m4 (gl_FUNC_LINK): Likewise.
* m4/linkat.m4 (gl_FUNC_LINKAT): Likewise.
* m4/mbrlen.m4 (gl_MBRLEN_RETVAL): Likewise.
* m4/mbrtowc.m4 (gl_MBRTOWC_RETVAL): Likewise.
* m4/mbsrtowcs.m4 (gl_MBSRTOWCS_WORKS): Likewise.
* m4/memchr.m4 (gl_FUNC_MEMCHR): Likewise.
* m4/memmem.m4 (gl_FUNC_MEMMEM): Likewise.
* m4/mkfifo.m4 (gl_FUNC_MKFIFO): Likewise.
* m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Likewise.
* m4/mktime.m4 (AC_FUNC_MKTIME): Likewise.
* m4/open.m4 (gl_FUNC_OPEN): Likewise.
* m4/poll.m4 (gl_FUNC_POLL): Likewise.
* m4/popen.m4 (gl_FUNC_POPEN): Likewise.
* m4/printf.m4 (gl_PRINTF_SIZES_C99, gl_PRINTF_LONG_DOUBLE,
gl_PRINTF_INFINITE, gl_PRINTF_INFINITE_LONG_DOUBLE,
gl_PRINTF_DIRECTIVE_A, gl_PRINTF_DIRECTIVE_F, gl_PRINTF_DIRECTIVE_LS,
gl_PRINTF_PRECISION): Likewise.
* m4/regex.m4 (gl_REGEX): Likewise.
* m4/rename.m4 (gl_FUNC_RENAME): Likewise.
* m4/rmdir.m4 (gl_FUNC_RMDIR): Likewise.
* m4/setenv.m4 (gl_FUNC_SETENV_SEPARATE): Likewise.
* m4/stat.m4 (gl_FUNC_STAT): Likewise.
* m4/stpncpy.m4 (gl_FUNC_STPNCPY): Likewise.
* m4/strcasestr.m4 (gl_FUNC_STRCASESTR): Likewise.
* m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Likewise.
* m4/strsignal.m4 (gl_FUNC_STRSIGNAL): Likewise.
* m4/strstr.m4 (gl_FUNC_STRSTR): Likewise.
* m4/strtod.m4 (gl_FUNC_STRTOD): Likewise.
* m4/symlink.m4 (gl_FUNC_SYMLINK): Likewise.
* m4/tsearch.m4 (gl_FUNC_TSEARCH): Likewise.
* m4/ttyname_r.m4 (gl_FUNC_TTYNAME_R): Likewise.
* m4/unlink-busy.m4 (gl_FUNC_UNLINK_BUSY_TEXT): Likewise.
* m4/unlink.m4 (gl_FUNC_UNLINK): Likewise.
* m4/utimensat.m4 (gl_FUNC_UTIMENSAT): Likewise.
* m4/utimes.m4 (gl_FUNC_UTIMES): Likewise.
* m4/wcrtomb.m4 (gl_FUNC_WCRTOMB): Likewise.
* m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Likewise.
* m4/signbit.m4 (gl_SIGNBIT_TEST_PROGRAM): Likewise.
(gl_FLOATTYPE_SIGN_LOCATION): Change test program so that it returns an
enumerated value.
* m4/acl.m4 (gl_ACL_GET_FILE): Use "if ... return 1; return 0;" style.
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,78 @@ +2010-12-04 Bruno Haible <bruno@clisp.org> + + Put more information about failed tests into the test return codes. + * m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Change test + program so that it returns an enumerated value (0, 1, 2, 3, 4, ...). + * m4/d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): Likewise. + * m4/getcwd-path-max.m4 (gl_FUNC_GETCWD_PATH_MAX): Likewise. + * m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): Likewise. + * m4/getdelim.m4 (gl_FUNC_GETDELIM): Likewise. + * m4/getline.m4 (gl_FUNC_GETLINE): Likewise. + * m4/intdiv0.m4 (gt_INTDIV0): Likewise. + * m4/isapipe.m4 (gl_PREREQ_ISAPIPE): Likewise. + * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Likewise. + * m4/posix_spawn.m4 (gl_POSIX_SPAWN_WORKS): Likewise. + * m4/putenv.m4 (gl_FUNC_PUTENV): Likewise. + * m4/sleep.m4 (gl_FUNC_SLEEP): Likewise. + * m4/stdint.m4 (gl_STDINT_H): Likewise. + * m4/calloc.m4 (_AC_FUNC_CALLOC_IF): Change test program so that it + returns a bit mask. + * m4/canonicalize.m4 (gl_FUNC_REALPATH_WORKS): Likewise. + * m4/chown.m4 (gl_FUNC_CHOWN_FOLLOWS_SYMLINK): Likewise. + * m4/dup2.m4 (gl_FUNC_DUP2): Likewise. + * m4/fcntl-o.m4 (gl_FCNTL_O_FLAGS): Likewise. + * m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Likewise. + * m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Likewise. + * m4/frexpl.m4 (gl_FUNC_FREXPL_WORKS): Likewise. + * m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Likewise. + * m4/iconv.m4 (AM_ICONV_LINK): Likewise. + * m4/iconv_open.m4 (gl_FUNC_ICONV_OPEN_UTF): Likewise. + * m4/isfinite.m4 (gl_ISFINITEL_WORKS): Likewise. + * m4/isnanf.m4 (gl_ISNANF_WORKS): Likewise. + * m4/isnanl.m4 (gl_FUNC_ISNANL_WORKS): Likewise. + * m4/ldexpl.m4 (gl_FUNC_LDEXPL_WORKS): Likewise. + * m4/link.m4 (gl_FUNC_LINK): Likewise. + * m4/linkat.m4 (gl_FUNC_LINKAT): Likewise. + * m4/mbrlen.m4 (gl_MBRLEN_RETVAL): Likewise. + * m4/mbrtowc.m4 (gl_MBRTOWC_RETVAL): Likewise. + * m4/mbsrtowcs.m4 (gl_MBSRTOWCS_WORKS): Likewise. + * m4/memchr.m4 (gl_FUNC_MEMCHR): Likewise. + * m4/memmem.m4 (gl_FUNC_MEMMEM): Likewise. + * m4/mkfifo.m4 (gl_FUNC_MKFIFO): Likewise. + * m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Likewise. + * m4/mktime.m4 (AC_FUNC_MKTIME): Likewise. + * m4/open.m4 (gl_FUNC_OPEN): Likewise. + * m4/poll.m4 (gl_FUNC_POLL): Likewise. + * m4/popen.m4 (gl_FUNC_POPEN): Likewise. + * m4/printf.m4 (gl_PRINTF_SIZES_C99, gl_PRINTF_LONG_DOUBLE, + gl_PRINTF_INFINITE, gl_PRINTF_INFINITE_LONG_DOUBLE, + gl_PRINTF_DIRECTIVE_A, gl_PRINTF_DIRECTIVE_F, gl_PRINTF_DIRECTIVE_LS, + gl_PRINTF_PRECISION): Likewise. + * m4/regex.m4 (gl_REGEX): Likewise. + * m4/rename.m4 (gl_FUNC_RENAME): Likewise. + * m4/rmdir.m4 (gl_FUNC_RMDIR): Likewise. + * m4/setenv.m4 (gl_FUNC_SETENV_SEPARATE): Likewise. + * m4/stat.m4 (gl_FUNC_STAT): Likewise. + * m4/stpncpy.m4 (gl_FUNC_STPNCPY): Likewise. + * m4/strcasestr.m4 (gl_FUNC_STRCASESTR): Likewise. + * m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Likewise. + * m4/strsignal.m4 (gl_FUNC_STRSIGNAL): Likewise. + * m4/strstr.m4 (gl_FUNC_STRSTR): Likewise. + * m4/strtod.m4 (gl_FUNC_STRTOD): Likewise. + * m4/symlink.m4 (gl_FUNC_SYMLINK): Likewise. + * m4/tsearch.m4 (gl_FUNC_TSEARCH): Likewise. + * m4/ttyname_r.m4 (gl_FUNC_TTYNAME_R): Likewise. + * m4/unlink-busy.m4 (gl_FUNC_UNLINK_BUSY_TEXT): Likewise. + * m4/unlink.m4 (gl_FUNC_UNLINK): Likewise. + * m4/utimensat.m4 (gl_FUNC_UTIMENSAT): Likewise. + * m4/utimes.m4 (gl_FUNC_UTIMES): Likewise. + * m4/wcrtomb.m4 (gl_FUNC_WCRTOMB): Likewise. + * m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Likewise. + * m4/signbit.m4 (gl_SIGNBIT_TEST_PROGRAM): Likewise. + (gl_FLOATTYPE_SIGN_LOCATION): Change test program so that it returns an + enumerated value. + * m4/acl.m4 (gl_ACL_GET_FILE): Use "if ... return 1; return 0;" style. + 2010-12-04 Bruno Haible <bruno@clisp.org> Update for Solaris 11 2010-11.
--- a/m4/acl.m4 +++ b/m4/acl.m4 @@ -1,5 +1,5 @@ # acl.m4 - check for access control list (ACL) primitives -# serial 11 +# serial 12 # Copyright (C) 2002, 2004-2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -151,8 +151,10 @@ #include <sys/acl.h> #include <errno.h> ]], - [[return !! (!acl_get_file (".", ACL_TYPE_ACCESS) - && errno == ENOENT);]])], + [[if (!acl_get_file (".", ACL_TYPE_ACCESS) && errno == ENOENT) + return 1; + return 0; + ]])], [gl_cv_func_working_acl_get_file=yes], [gl_cv_func_working_acl_get_file=no], [gl_cv_func_working_acl_get_file=cross-compiling])])
--- a/m4/c-stack.m4 +++ b/m4/c-stack.m4 @@ -8,7 +8,7 @@ # Written by Paul Eggert. -# serial 11 +# serial 12 AC_DEFUN([AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC], [# for STACK_DIRECTION @@ -77,16 +77,18 @@ st.ss_size = SIGSTKSZ; r = sigaltstack (&st, 0); if (r != 0) - return r; + return 1; sigemptyset (&act.sa_mask); act.sa_flags = SA_NODEFER | SA_ONSTACK | SA_RESETHAND; act.sa_handler = segv_handler; #if FAULT_YIELDS_SIGBUS if (sigaction (SIGBUS, &act, 0) < 0) - return -1; + return 2; #endif - return sigaction (SIGSEGV, &act, 0); + if (sigaction (SIGSEGV, &act, 0) < 0) + return 3; + return 0; } static volatile int * recurse_1 (volatile int n, volatile int *p) @@ -104,6 +106,7 @@ int main () { + int result; #if HAVE_SETRLIMIT && defined RLIMIT_STACK /* Before starting the endless recursion, try to be friendly to the user's machine. On some Linux 2.2.x systems, there @@ -114,7 +117,10 @@ setrlimit (RLIMIT_STACK, &rl); #endif - return c_stack_action () || recurse (0); + result = c_stack_action (); + if (result != 0) + return result; + return recurse (0); } ]])], [ac_cv_sys_stack_overflow_works=yes], @@ -177,7 +183,7 @@ exit(3); /* Provoke a SIGSEGV. */ raise (SIGSEGV); - exit (3); + exit (4); }]])], [gl_cv_sigaltstack_low_base=yes], [gl_cv_sigaltstack_low_base=no], @@ -245,9 +251,9 @@ s += page_size; if (s < stack_size + page_size) _exit (0); + _exit (4); } - - _exit (1); + _exit (5); } static int @@ -263,16 +269,18 @@ st.ss_size = SIGSTKSZ; r = sigaltstack (&st, 0); if (r != 0) - return r; + return 1; sigemptyset (&act.sa_mask); act.sa_flags = SA_NODEFER | SA_ONSTACK | SA_RESETHAND | SA_SIGINFO; act.sa_sigaction = segv_handler; #if FAULT_YIELDS_SIGBUS if (sigaction (SIGBUS, &act, 0) < 0) - return -1; + return 2; #endif - return sigaction (SIGSEGV, &act, 0); + if (sigaction (SIGSEGV, &act, 0) < 0) + return 3; + return 0; } static volatile int * recurse_1 (volatile int n, volatile int *p) @@ -290,6 +298,7 @@ int main () { + int result; #if HAVE_SETRLIMIT && defined RLIMIT_STACK /* Before starting the endless recursion, try to be friendly to the user's machine. On some Linux 2.2.x systems, there @@ -300,7 +309,10 @@ setrlimit (RLIMIT_STACK, &rl); #endif - return c_stack_action () || recurse (0); + result = c_stack_action (); + if (result != 0) + return result; + return recurse (0); } ]])], [ac_cv_sys_xsi_stack_overflow_heuristic=yes],
--- a/m4/calloc.m4 +++ b/m4/calloc.m4 @@ -1,4 +1,4 @@ -# calloc.m4 serial 11 +# calloc.m4 serial 12 # Copyright (C) 2004-2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -16,14 +16,24 @@ # ------------------------------------- # If `calloc (0, 0)' is properly handled, run IF-WORKS, otherwise, IF-NOT. AC_DEFUN([_AC_FUNC_CALLOC_IF], -[AC_REQUIRE([AC_TYPE_SIZE_T])dnl -AC_CACHE_CHECK([for GNU libc compatible calloc], [ac_cv_func_calloc_0_nonnull], -[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], - [[exit (!calloc (0, 0) || calloc ((size_t) -1 / 8 + 1, 8));]])], - [ac_cv_func_calloc_0_nonnull=yes], - [ac_cv_func_calloc_0_nonnull=no], - [ac_cv_func_calloc_0_nonnull=no])]) -AS_IF([test $ac_cv_func_calloc_0_nonnull = yes], [$1], [$2]) +[ + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_CACHE_CHECK([for GNU libc compatible calloc], + [ac_cv_func_calloc_0_nonnull], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT], + [[int result = 0; + if (!calloc (0, 0)) + result |= 1; + if (calloc ((size_t) -1 / 8 + 1, 8)) + result |= 2; + return result; + ]])], + [ac_cv_func_calloc_0_nonnull=yes], + [ac_cv_func_calloc_0_nonnull=no], + [ac_cv_func_calloc_0_nonnull=no])]) + AS_IF([test $ac_cv_func_calloc_0_nonnull = yes], [$1], [$2]) ])# AC_FUNC_CALLOC
--- a/m4/canonicalize.m4 +++ b/m4/canonicalize.m4 @@ -1,4 +1,4 @@ -# canonicalize.m4 serial 16 +# canonicalize.m4 serial 17 dnl Copyright (C) 2003-2007, 2009-2010 Free Software Foundation, Inc. @@ -65,10 +65,23 @@ AC_LANG_PROGRAM([[ #include <stdlib.h> ]], [[ - char *name1 = realpath ("conftest.a", NULL); - char *name2 = realpath ("conftest.b/../conftest.a", NULL); - char *name3 = realpath ("conftest.a/", NULL); - return !(name1 && *name1 == '/' && !name2 && !name3); + int result = 0; + { + char *name = realpath ("conftest.a", NULL); + if (!(name && *name == '/')) + result |= 1; + } + { + char *name = realpath ("conftest.b/../conftest.a", NULL); + if (name != NULL) + result |= 2; + } + { + char *name = realpath ("conftest.a/", NULL); + if (name != NULL) + result |= 4; + } + return result; ]]) ], [gl_cv_func_realpath_works=yes], [gl_cv_func_realpath_works=no], [gl_cv_func_realpath_works="guessing no"])
--- a/m4/chown.m4 +++ b/m4/chown.m4 @@ -1,4 +1,4 @@ -# serial 23 +# serial 24 # Determine whether we need the chown wrapper. dnl Copyright (C) 1997-2001, 2003-2005, 2007, 2009-2010 Free Software @@ -114,6 +114,7 @@ int main () { + int result = 0; char const *dangling_symlink = "conftest.dangle"; unlink (dangling_symlink); @@ -122,8 +123,11 @@ /* Exit successfully on a conforming system, i.e., where chown must fail with ENOENT. */ - exit ( ! (chown (dangling_symlink, getuid (), getgid ()) != 0 - && errno == ENOENT)); + if (chown (dangling_symlink, getuid (), getgid ()) == 0) + result |= 1; + if (errno != ENOENT) + result |= 2; + return result; } ]])], [gl_cv_func_chown_follows_symlink=yes],
--- a/m4/d-ino.m4 +++ b/m4/d-ino.m4 @@ -1,4 +1,4 @@ -# serial 11 +# serial 12 dnl From Jim Meyering. dnl @@ -27,12 +27,17 @@ if (! dp) return 1; e = readdir (dp); - return ! (e - && stat (e->d_name, &st) == 0 - && e->d_ino == st.st_ino);]])], - [gl_cv_struct_dirent_d_ino=yes], - [gl_cv_struct_dirent_d_ino=no], - [gl_cv_struct_dirent_d_ino=no])]) + if (! e) + return 2; + if (stat (e->d_name, &st) != 0) + return 3; + if (e->d_ino != st.st_ino) + return 4; + return 0; + ]])], + [gl_cv_struct_dirent_d_ino=yes], + [gl_cv_struct_dirent_d_ino=no], + [gl_cv_struct_dirent_d_ino=no])]) if test $gl_cv_struct_dirent_d_ino = yes; then AC_DEFINE([D_INO_IN_DIRENT], [1], [Define if struct dirent has a member d_ino that actually works.])
--- a/m4/dup2.m4 +++ b/m4/dup2.m4 @@ -1,4 +1,4 @@ -#serial 10 +#serial 11 dnl Copyright (C) 2002, 2005, 2007, 2009-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -17,15 +17,16 @@ [AC_RUN_IFELSE([ AC_LANG_PROGRAM([[#include <unistd.h> #include <errno.h>]], - [if (dup2 (1, 1) == 0) - return 1; + [int result = 0; + if (dup2 (1, 1) == 0) + result |= 1; close (0); if (dup2 (0, 0) != -1) - return 2; + result |= 2; /* Many gnulib modules require POSIX conformance of EBADF. */ if (dup2 (1, 1000000) == -1 && errno != EBADF) - return 3; - return 0; + result |= 4; + return result; ]) ], [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no],
--- a/m4/fcntl-o.m4 +++ b/m4/fcntl-o.m4 @@ -1,4 +1,4 @@ -# fcntl-o.m4 serial 2 +# fcntl-o.m4 serial 3 dnl Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -37,34 +37,61 @@ }; ]], [[ - int status = !constants; + int result = !constants; { static char const sym[] = "conftest.sym"; - if (symlink (".", sym) != 0 - || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0) - status |= 32; + if (symlink (".", sym) != 0) + result |= 2; + else + { + int fd = open (sym, O_RDONLY | O_NOFOLLOW); + if (fd >= 0) + { + close (fd); + result |= 4; + } + } unlink (sym); } { static char const file[] = "confdefs.h"; int fd = open (file, O_RDONLY | O_NOATIME); - char c; - struct stat st0, st1; - if (fd < 0 - || fstat (fd, &st0) != 0 - || sleep (1) != 0 - || read (fd, &c, 1) != 1 - || close (fd) != 0 - || stat (file, &st1) != 0 - || st0.st_atime != st1.st_atime) - status |= 64; + if (fd < 0) + result |= 8; + else + { + struct stat st0; + if (fstat (fd, &st0) != 0) + result |= 16; + else + { + char c; + sleep (1); + if (read (fd, &c, 1) != 1) + result |= 24; + else + { + if (close (fd) != 0) + result |= 32; + else + { + struct stat st1; + if (stat (file, &st1) != 0) + result |= 40; + else + if (st0.st_atime != st1.st_atime) + result |= 64; + } + } + } + } } - return status;]])], + return result;]])], [gl_cv_header_working_fcntl_h=yes], [case $? in #( - 32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( + 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( - 96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( + 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( *) gl_cv_header_working_fcntl_h='no';; esac], [gl_cv_header_working_fcntl_h=cross-compiling])])
--- a/m4/fnmatch.m4 +++ b/m4/fnmatch.m4 @@ -1,4 +1,4 @@ -# Check for fnmatch - serial 4. +# Check for fnmatch - serial 5. # Copyright (C) 2000-2007, 2009-2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -60,33 +60,60 @@ static char const a01[] = { 'a' + 1, 0 }; static char const bs_1[] = { '\\\\' - 1, 0 }; static char const bs01[] = { '\\\\' + 1, 0 }; - return - !(n ("a*", "", 0) - && y ("a*", "abc", 0) - && n ("d*/*1", "d/s/1", FNM_PATHNAME) - && y ("a\\\\bc", "abc", 0) - && n ("a\\\\bc", "abc", FNM_NOESCAPE) - && y ("*x", ".x", 0) - && n ("*x", ".x", FNM_PERIOD) - && y (Apat, "\\\\", 0) && y (Apat, "A", 0) - && y (apat, "\\\\", 0) && y (apat, "a", 0) - && n (Apat, A_1, 0) == ('A' < '\\\\') - && n (apat, a_1, 0) == ('a' < '\\\\') - && y (Apat, A01, 0) == ('A' < '\\\\') - && y (apat, a01, 0) == ('a' < '\\\\') - && y (Apat, bs_1, 0) == ('A' < '\\\\') - && y (apat, bs_1, 0) == ('a' < '\\\\') - && n (Apat, bs01, 0) == ('A' < '\\\\') - && n (apat, bs01, 0) == ('a' < '\\\\') - $gl_fnmatch_gnu_start - && y ("xxXX", "xXxX", FNM_CASEFOLD) - && y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH) - && n ("d*/*1", "d/s/1", FNM_FILE_NAME) - && y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR) - && y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR) - && y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR) - $gl_fnmatch_gnu_end - ); + int result = 0; + if (!n ("a*", "", 0)) + return 1; + if (!y ("a*", "abc", 0)) + return 1; + if (!n ("d*/*1", "d/s/1", FNM_PATHNAME)) + return 2; + if (!y ("a\\\\bc", "abc", 0)) + return 3; + if (!n ("a\\\\bc", "abc", FNM_NOESCAPE)) + return 3; + if (!y ("*x", ".x", 0)) + return 4; + if (!n ("*x", ".x", FNM_PERIOD)) + return 4; + if (!y (Apat, "\\\\", 0)) + return 5; + if (!y (Apat, "A", 0)) + return 5; + if (!y (apat, "\\\\", 0)) + return 5; + if (!y (apat, "a", 0)) + return 5; + if (!(n (Apat, A_1, 0) == ('A' < '\\\\'))) + return 5; + if (!(n (apat, a_1, 0) == ('a' < '\\\\'))) + return 5; + if (!(y (Apat, A01, 0) == ('A' < '\\\\'))) + return 5; + if (!(y (apat, a01, 0) == ('a' < '\\\\'))) + return 5; + if (!(y (Apat, bs_1, 0) == ('A' < '\\\\'))) + return 5; + if (!(y (apat, bs_1, 0) == ('a' < '\\\\'))) + return 5; + if (!(n (Apat, bs01, 0) == ('A' < '\\\\'))) + return 5; + if (!(n (apat, bs01, 0) == ('a' < '\\\\'))) + return 5; + $gl_fnmatch_gnu_start + if (!y ("xxXX", "xXxX", FNM_CASEFOLD)) + result |= 8; + if (!y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH)) + result |= 16; + if (!n ("d*/*1", "d/s/1", FNM_FILE_NAME)) + result |= 32; + if (!y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR)) + result |= 64; + if (!y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR)) + result |= 64; + if (!y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)) + result |= 64; + $gl_fnmatch_gnu_end + return result; ]])], [eval "$gl_fnmatch_cache_var=yes"], [eval "$gl_fnmatch_cache_var=no"],
--- a/m4/frexp.m4 +++ b/m4/frexp.m4 @@ -1,4 +1,4 @@ -# frexp.m4 serial 9 +# frexp.m4 serial 10 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -120,6 +120,7 @@ #endif int main() { + int result = 0; int i; volatile double x; double zero = 0.0; @@ -133,7 +134,7 @@ /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022. On NetBSD: y = 0.75. Correct: y = 0.5. */ if (y != 0.5) - return 1; + result |= 1; } /* Test on infinite numbers. */ x = 1.0 / 0.0; @@ -141,7 +142,7 @@ int exp; double y = frexp (x, &exp); if (y != x) - return 1; + result |= 2; } /* Test on negative zero. */ x = minus_zero; @@ -149,9 +150,9 @@ int exp; double y = frexp (x, &exp); if (memcmp (&y, &x, sizeof x)) - return 1; + result |= 4; } - return 0; + return result; }]])], [gl_cv_func_frexp_works=yes], [gl_cv_func_frexp_works=no],
--- a/m4/frexpl.m4 +++ b/m4/frexpl.m4 @@ -1,4 +1,4 @@ -# frexpl.m4 serial 12 +# frexpl.m4 serial 13 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -124,6 +124,7 @@ extern long double frexpl (long double, int *); int main() { + int result = 0; volatile long double x; /* Test on finite numbers that fails on AIX 5.1. */ x = 16.0L; @@ -131,7 +132,7 @@ int exp = -9999; frexpl (x, &exp); if (exp != 5) - return 1; + result |= 1; } /* Test on finite numbers that fails on MacOS X 10.4, because its frexpl function returns an invalid (incorrectly normalized) value: it returns @@ -143,7 +144,7 @@ int exp = -9999; long double y = frexpl (x, &exp); if (!(exp == 1 && y == 0.505L)) - return 1; + result |= 2; } /* Test on large finite numbers. This fails on BeOS at i = 16322, while LDBL_MAX_EXP = 16384. @@ -156,7 +157,10 @@ int exp = -9999; frexpl (x, &exp); if (exp != i) - return 1; + { + result |= 4; + break; + } } } /* Test on denormalized numbers. */ @@ -171,7 +175,7 @@ /* On machines with IEEE854 arithmetic: x = 1.68105e-4932, exp = -16382, y = 0.5. On MacOS X 10.5: exp = -16384, y = 0.5. */ if (exp != LDBL_MIN_EXP - 1) - return 1; + result |= 8; } } /* Test on infinite numbers. */ @@ -180,9 +184,9 @@ int exp; long double y = frexpl (x, &exp); if (y != x) - return 1; + result |= 16; } - return 0; + return result; }]])], [gl_cv_func_frexpl_works=yes], [gl_cv_func_frexpl_works=no],
--- a/m4/getcwd-path-max.m4 +++ b/m4/getcwd-path-max.m4 @@ -1,4 +1,4 @@ -# serial 14 +# serial 15 # Check for several getcwd bugs with long file names. # If so, arrange to compile the wrapper function. @@ -85,7 +85,7 @@ size_t n_chdirs = 0; if (cwd == NULL) - exit (1); + exit (10); cwd_len = initial_cwd_len = strlen (cwd); @@ -103,7 +103,7 @@ if (mkdir (DIR_NAME, S_IRWXU) < 0 || chdir (DIR_NAME) < 0) { if (! (errno == ERANGE || is_ENAMETOOLONG (errno))) - fail = 2; + fail = 20; break; } @@ -112,12 +112,12 @@ c = getcwd (buf, PATH_MAX); if (!c && errno == ENOENT) { - fail = 1; + fail = 11; break; } if (c || ! (errno == ERANGE || is_ENAMETOOLONG (errno))) { - fail = 2; + fail = 21; break; } } @@ -132,12 +132,12 @@ if (! (errno == ERANGE || errno == ENOENT || is_ENAMETOOLONG (errno))) { - fail = 2; + fail = 22; break; } if (AT_FDCWD || errno == ERANGE || errno == ENOENT) { - fail = 1; + fail = 12; break; } } @@ -145,7 +145,7 @@ if (c && strlen (c) != cwd_len) { - fail = 2; + fail = 23; break; } ++n_chdirs; @@ -174,7 +174,7 @@ ]])], [gl_cv_func_getcwd_path_max=yes], [case $? in - 1) gl_cv_func_getcwd_path_max='no, but it is partly working';; + 10|11|12) gl_cv_func_getcwd_path_max='no, but it is partly working';; *) gl_cv_func_getcwd_path_max=no;; esac], [gl_cv_func_getcwd_path_max=no])
--- a/m4/getcwd.m4 +++ b/m4/getcwd.m4 @@ -7,7 +7,7 @@ # with or without modifications, as long as this notice is preserved. # Written by Paul Eggert. -# serial 2 +# serial 3 AC_DEFUN([gl_FUNC_GETCWD_NULL], [ @@ -27,7 +27,13 @@ else { char *f = getcwd (NULL, 0); - return ! (f && f[0] == '/' && !f[1]); + if (! f) + return 2; + if (f[0] != '/') + return 3; + if (f[1] != '\0') + return 4; + return 0; } #endif ]])],
--- a/m4/getdelim.m4 +++ b/m4/getdelim.m4 @@ -1,4 +1,4 @@ -# getdelim.m4 serial 7 +# getdelim.m4 serial 8 dnl Copyright (C) 2005-2007, 2009-2010 Free Software Foundation, Inc. dnl @@ -38,7 +38,7 @@ size_t siz = 0; int len = getdelim (&line, &siz, '\n', in); if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) - return 1; + return 2; } { /* Test result for a NULL buffer and a non-zero size. @@ -46,7 +46,7 @@ char *line = NULL; size_t siz = (size_t)(~0) / 4; if (getdelim (&line, &siz, '\n', in) == -1) - return 1; + return 3; } return 0; }
--- a/m4/getline.m4 +++ b/m4/getline.m4 @@ -1,4 +1,4 @@ -# getline.m4 serial 22 +# getline.m4 serial 23 dnl Copyright (C) 1998-2003, 2005-2007, 2009-2010 Free Software Foundation, dnl Inc. @@ -46,7 +46,7 @@ size_t siz = 0; int len = getline (&line, &siz, in); if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) - return 1; + return 2; } { /* Test result for a NULL buffer and a non-zero size. @@ -54,7 +54,7 @@ char *line = NULL; size_t siz = (size_t)(~0) / 4; if (getline (&line, &siz, in) == -1) - return 1; + return 3; } return 0; }
--- a/m4/getopt.m4 +++ b/m4/getopt.m4 @@ -1,4 +1,4 @@ -# getopt.m4 serial 31 +# getopt.m4 serial 32 dnl Copyright (C) 2002-2006, 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -231,6 +231,7 @@ #include <stddef.h> #include <string.h> ]], [[ + int result = 0; /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw, and fails on MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10. */ @@ -241,7 +242,7 @@ myargv[2] = 0; opterr = 0; if (getopt (2, myargv, "+a") != '?') - return 1; + result |= 1; } /* This code succeeds on glibc 2.8, mingw, and fails on MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, @@ -251,33 +252,33 @@ optind = 1; if (getopt (4, argv, "p::") != 'p') - return 2; - if (optarg != NULL) - return 3; - if (getopt (4, argv, "p::") != -1) - return 4; - if (optind != 2) - return 5; + result |= 2; + else if (optarg != NULL) + result |= 4; + else if (getopt (4, argv, "p::") != -1) + result |= 6; + else if (optind != 2) + result |= 8; } /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */ { char *argv[] = { "program", "foo", "-p", NULL }; optind = 0; if (getopt (3, argv, "-p") != 1) - return 6; - if (getopt (3, argv, "-p") != 'p') - return 7; + result |= 16; + else if (getopt (3, argv, "-p") != 'p') + result |= 32; } /* This code fails on glibc 2.11. */ { char *argv[] = { "program", "-b", "-a", NULL }; optind = opterr = 0; if (getopt (3, argv, "+:a:b") != 'b') - return 8; - if (getopt (3, argv, "+:a:b") != ':') - return 9; + result |= 64; + else if (getopt (3, argv, "+:a:b") != ':') + result |= 64; } - return 0; + return result; ]])], [gl_cv_func_getopt_gnu=yes], [gl_cv_func_getopt_gnu=no],
--- a/m4/iconv.m4 +++ b/m4/iconv.m4 @@ -1,4 +1,4 @@ -# iconv.m4 serial 16 (gettext-0.18.2) +# iconv.m4 serial 17 (gettext-0.18.2) dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -78,6 +78,7 @@ #include <string.h> int main () { + int result = 0; /* Test against AIX 5.1 bug: Failures are not distinguishable from successful returns. */ { @@ -94,7 +95,8 @@ (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) - return 1; + result |= 1; + iconv_close (cd_utf8_to_88591); } } /* Test against Solaris 10 bug: Failures are not distinguishable from @@ -113,7 +115,8 @@ (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) - return 1; + result |= 2; + iconv_close (cd_ascii_to_88591); } } /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ @@ -131,7 +134,8 @@ (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) - return 1; + result |= 4; + iconv_close (cd_88591_to_utf8); } } #if 0 /* This bug could be worked around by the caller. */ @@ -150,7 +154,8 @@ (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) - return 1; + result |= 8; + iconv_close (cd_88591_to_utf8); } } #endif @@ -164,8 +169,8 @@ && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) /* Try HP-UX names. */ && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) - return 1; - return 0; + result |= 16; + return result; }]])], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
--- a/m4/iconv_open.m4 +++ b/m4/iconv_open.m4 @@ -1,4 +1,4 @@ -# iconv_open.m4 serial 10 +# iconv_open.m4 serial 11 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -64,9 +64,9 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) if (!(expr)) return 1; int main () { + int result = 0; /* Test conversion from UTF-8 to UTF-16BE with no errors. */ { static const char input[] = @@ -74,25 +74,33 @@ static const char expected[] = "\000J\000a\000p\000a\000n\000e\000s\000e\000 \000(\145\345\147\054\212\236\000)\000 \000[\330\065\335\015\330\065\335\036\330\065\335\055\000]"; iconv_t cd; - char buf[100]; - const char *inptr; - size_t inbytesleft; - char *outptr; - size_t outbytesleft; - size_t res; cd = iconv_open ("UTF-16BE", "UTF-8"); - ASSERT (cd != (iconv_t)(-1)); - inptr = input; - inbytesleft = sizeof (input) - 1; - outptr = buf; - outbytesleft = sizeof (buf); - res = iconv (cd, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - ASSERT (res == 0 && inbytesleft == 0); - ASSERT (outptr == buf + (sizeof (expected) - 1)); - ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); - ASSERT (iconv_close (cd) == 0); + if (cd == (iconv_t)(-1)) + result |= 1; + else + { + char buf[100]; + const char *inptr; + size_t inbytesleft; + char *outptr; + size_t outbytesleft; + size_t res; + inptr = input; + inbytesleft = sizeof (input) - 1; + outptr = buf; + outbytesleft = sizeof (buf); + res = iconv (cd, + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (!(res == 0 && inbytesleft == 0)) + result |= 1; + else if (!(outptr == buf + (sizeof (expected) - 1))) + result |= 1; + else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0)) + result |= 1; + else if (!(iconv_close (cd) == 0)) + result |= 1; + } } /* Test conversion from UTF-8 to UTF-16LE with no errors. */ { @@ -101,25 +109,33 @@ static const char expected[] = "J\000a\000p\000a\000n\000e\000s\000e\000 \000(\000\345\145\054\147\236\212)\000 \000[\000\065\330\015\335\065\330\036\335\065\330\055\335]\000"; iconv_t cd; - char buf[100]; - const char *inptr; - size_t inbytesleft; - char *outptr; - size_t outbytesleft; - size_t res; cd = iconv_open ("UTF-16LE", "UTF-8"); - ASSERT (cd != (iconv_t)(-1)); - inptr = input; - inbytesleft = sizeof (input) - 1; - outptr = buf; - outbytesleft = sizeof (buf); - res = iconv (cd, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - ASSERT (res == 0 && inbytesleft == 0); - ASSERT (outptr == buf + (sizeof (expected) - 1)); - ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); - ASSERT (iconv_close (cd) == 0); + if (cd == (iconv_t)(-1)) + result |= 2; + else + { + char buf[100]; + const char *inptr; + size_t inbytesleft; + char *outptr; + size_t outbytesleft; + size_t res; + inptr = input; + inbytesleft = sizeof (input) - 1; + outptr = buf; + outbytesleft = sizeof (buf); + res = iconv (cd, + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (!(res == 0 && inbytesleft == 0)) + result |= 2; + else if (!(outptr == buf + (sizeof (expected) - 1))) + result |= 2; + else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0)) + result |= 2; + else if (!(iconv_close (cd) == 0)) + result |= 2; + } } /* Test conversion from UTF-8 to UTF-32BE with no errors. */ { @@ -128,25 +144,33 @@ static const char expected[] = "\000\000\000J\000\000\000a\000\000\000p\000\000\000a\000\000\000n\000\000\000e\000\000\000s\000\000\000e\000\000\000 \000\000\000(\000\000\145\345\000\000\147\054\000\000\212\236\000\000\000)\000\000\000 \000\000\000[\000\001\325\015\000\001\325\036\000\001\325\055\000\000\000]"; iconv_t cd; - char buf[100]; - const char *inptr; - size_t inbytesleft; - char *outptr; - size_t outbytesleft; - size_t res; cd = iconv_open ("UTF-32BE", "UTF-8"); - ASSERT (cd != (iconv_t)(-1)); - inptr = input; - inbytesleft = sizeof (input) - 1; - outptr = buf; - outbytesleft = sizeof (buf); - res = iconv (cd, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - ASSERT (res == 0 && inbytesleft == 0); - ASSERT (outptr == buf + (sizeof (expected) - 1)); - ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); - ASSERT (iconv_close (cd) == 0); + if (cd == (iconv_t)(-1)) + result |= 4; + else + { + char buf[100]; + const char *inptr; + size_t inbytesleft; + char *outptr; + size_t outbytesleft; + size_t res; + inptr = input; + inbytesleft = sizeof (input) - 1; + outptr = buf; + outbytesleft = sizeof (buf); + res = iconv (cd, + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (!(res == 0 && inbytesleft == 0)) + result |= 4; + else if (!(outptr == buf + (sizeof (expected) - 1))) + result |= 4; + else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0)) + result |= 4; + else if (!(iconv_close (cd) == 0)) + result |= 4; + } } /* Test conversion from UTF-8 to UTF-32LE with no errors. */ { @@ -155,25 +179,33 @@ static const char expected[] = "J\000\000\000a\000\000\000p\000\000\000a\000\000\000n\000\000\000e\000\000\000s\000\000\000e\000\000\000 \000\000\000(\000\000\000\345\145\000\000\054\147\000\000\236\212\000\000)\000\000\000 \000\000\000[\000\000\000\015\325\001\000\036\325\001\000\055\325\001\000]\000\000\000"; iconv_t cd; - char buf[100]; - const char *inptr; - size_t inbytesleft; - char *outptr; - size_t outbytesleft; - size_t res; cd = iconv_open ("UTF-32LE", "UTF-8"); - ASSERT (cd != (iconv_t)(-1)); - inptr = input; - inbytesleft = sizeof (input) - 1; - outptr = buf; - outbytesleft = sizeof (buf); - res = iconv (cd, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - ASSERT (res == 0 && inbytesleft == 0); - ASSERT (outptr == buf + (sizeof (expected) - 1)); - ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); - ASSERT (iconv_close (cd) == 0); + if (cd == (iconv_t)(-1)) + result |= 8; + else + { + char buf[100]; + const char *inptr; + size_t inbytesleft; + char *outptr; + size_t outbytesleft; + size_t res; + inptr = input; + inbytesleft = sizeof (input) - 1; + outptr = buf; + outbytesleft = sizeof (buf); + res = iconv (cd, + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (!(res == 0 && inbytesleft == 0)) + result |= 8; + else if (!(outptr == buf + (sizeof (expected) - 1))) + result |= 8; + else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0)) + result |= 8; + else if ((iconv_close (cd) == 0)) + result |= 8; + } } /* Test conversion from UTF-16BE to UTF-8 with no errors. This test fails on NetBSD 3.0. */ @@ -183,27 +215,35 @@ static const char expected[] = "Japanese (\346\227\245\346\234\254\350\252\236) [\360\235\224\215\360\235\224\236\360\235\224\255]"; iconv_t cd; - char buf[100]; - const char *inptr; - size_t inbytesleft; - char *outptr; - size_t outbytesleft; - size_t res; cd = iconv_open ("UTF-8", "UTF-16BE"); - ASSERT (cd != (iconv_t)(-1)); - inptr = input; - inbytesleft = sizeof (input) - 1; - outptr = buf; - outbytesleft = sizeof (buf); - res = iconv (cd, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - ASSERT (res == 0 && inbytesleft == 0); - ASSERT (outptr == buf + (sizeof (expected) - 1)); - ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); - ASSERT (iconv_close (cd) == 0); + if (cd == (iconv_t)(-1)) + result |= 16; + else + { + char buf[100]; + const char *inptr; + size_t inbytesleft; + char *outptr; + size_t outbytesleft; + size_t res; + inptr = input; + inbytesleft = sizeof (input) - 1; + outptr = buf; + outbytesleft = sizeof (buf); + res = iconv (cd, + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (!(res == 0 && inbytesleft == 0)) + result |= 16; + else if (!(outptr == buf + (sizeof (expected) - 1))) + result |= 16; + else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0)) + result |= 16; + else if (!(iconv_close (cd) == 0)) + result |= 16; + } } - return 0; + return result; }]])], [gl_cv_func_iconv_supports_utf=yes], [gl_cv_func_iconv_supports_utf=no],
--- a/m4/intdiv0.m4 +++ b/m4/intdiv0.m4 @@ -1,4 +1,4 @@ -# intdiv0.m4 serial 4 (gettext-0.18.2) +# intdiv0.m4 serial 5 (gettext-0.18.2) dnl Copyright (C) 2002, 2007-2008, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -60,7 +60,7 @@ z = x / y; nan = y / y; - exit (1); + exit (2); } ]])], [gt_cv_int_divbyzero_sigfpe=yes],
--- a/m4/isapipe.m4 +++ b/m4/isapipe.m4 @@ -39,8 +39,10 @@ { int fd[2]; struct stat st; - if (pipe (fd) != 0 || fstat (fd[0], &st) != 0) + if (pipe (fd) != 0) return 1; + if (fstat (fd[0], &st) != 0) + return 2; if (2 <= argc && argv[1][0] == '-') { char const *yesno = (S_ISFIFO (st.st_mode) ? "yes" : "no"); @@ -48,21 +50,21 @@ { long int i = st.st_nlink; if (i != st.st_nlink) - return 1; + return 3; printf ("%s (%ld)\n", yesno, i); } else { unsigned long int i = st.st_nlink; if (i != st.st_nlink) - return 1; + return 4; printf ("%s (%lu)\n", yesno, i); } } else { if (! S_ISFIFO (st.st_mode) && ! S_ISSOCK (st.st_mode)) - return 1; + return 5; } return 0; }]])],
--- a/m4/isfinite.m4 +++ b/m4/isfinite.m4 @@ -1,4 +1,4 @@ -# isfinite.m4 serial 7 +# isfinite.m4 serial 8 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -68,19 +68,23 @@ #endif int main () { - memory_long_double m; - unsigned int i; + int result = 0; + + { + memory_long_double m; + unsigned int i; - /* The isfinite macro should be immune against changes in the sign bit and - in the mantissa bits. The xor operation twiddles a bit that can only be - a sign bit or a mantissa bit (since the exponent never extends to - bit 31). */ - m.value = NaNl (); - m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); - for (i = 0; i < NWORDS; i++) - m.word[i] |= 1; - if (isfinite (m.value)) - return 1; + /* The isfinite macro should be immune against changes in the sign bit and + in the mantissa bits. The xor operation twiddles a bit that can only be + a sign bit or a mantissa bit (since the exponent never extends to + bit 31). */ + m.value = NaNl (); + m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); + for (i = 0; i < NWORDS; i++) + m.word[i] |= 1; + if (isfinite (m.value)) + result |= 1; + } #if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) /* Representation of an 80-bit 'long double' as an initializer for a sequence @@ -99,14 +103,14 @@ static memory_long_double x = { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; if (isfinite (x.value)) - return 1; + result |= 2; } { /* Signalling NaN. */ static memory_long_double x = { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; if (isfinite (x.value)) - return 1; + result |= 2; } /* The isfinite macro should recognize Pseudo-NaNs, Pseudo-Infinities, Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in @@ -119,35 +123,35 @@ static memory_long_double x = { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; if (isfinite (x.value)) - return 1; + result |= 4; } { /* Pseudo-Infinity. */ static memory_long_double x = { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; if (isfinite (x.value)) - return 1; + result |= 8; } { /* Pseudo-Zero. */ static memory_long_double x = { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; if (isfinite (x.value)) - return 1; + result |= 16; } { /* Unnormalized number. */ static memory_long_double x = { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; if (isfinite (x.value)) - return 1; + result |= 32; } { /* Pseudo-Denormal. */ static memory_long_double x = { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; if (isfinite (x.value)) - return 1; + return |= 64; } #endif - return 0; + return result; }]])], [gl_cv_func_isfinitel_works=yes], [gl_cv_func_isfinitel_works=no], [case "$host_cpu" in # Guess no on ia64, x86_64, i386.
--- a/m4/isnanf.m4 +++ b/m4/isnanf.m4 @@ -1,4 +1,4 @@ -# isnanf.m4 serial 11 +# isnanf.m4 serial 12 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -150,13 +150,13 @@ typedef union { unsigned int word[NWORDS]; float value; } memory_float; int main() { - memory_float m; + int result = 0; if (isnanf (1.0f / 0.0f)) - return 1; + result |= 1; if (!isnanf (NaN ())) - return 1; + result |= 2; #if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT /* The isnanf function should be immune against changes in the sign bit and @@ -164,16 +164,18 @@ a sign bit or a mantissa bit. */ if (FLT_EXPBIT0_WORD == 0 && FLT_EXPBIT0_BIT > 0) { + memory_float m; + m.value = NaN (); /* Set the bits below the exponent to 01111...111. */ m.word[0] &= -1U << FLT_EXPBIT0_BIT; m.word[0] |= 1U << (FLT_EXPBIT0_BIT - 1) - 1; if (!isnanf (m.value)) - return 1; + result |= 4; } #endif - return 0; + return result; }]])], [gl_cv_func_isnanf_works=yes], [gl_cv_func_isnanf_works=no],
--- a/m4/isnanl.m4 +++ b/m4/isnanl.m4 @@ -1,4 +1,4 @@ -# isnanl.m4 serial 13 +# isnanl.m4 serial 14 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -151,22 +151,26 @@ #endif int main () { - memory_long_double m; - unsigned int i; + int result = 0; if (!isnanl (NaNl ())) - return 1; + result |= 1; + + { + memory_long_double m; + unsigned int i; - /* The isnanl function should be immune against changes in the sign bit and - in the mantissa bits. The xor operation twiddles a bit that can only be - a sign bit or a mantissa bit (since the exponent never extends to - bit 31). */ - m.value = NaNl (); - m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); - for (i = 0; i < NWORDS; i++) - m.word[i] |= 1; - if (!isnanl (m.value)) - return 1; + /* The isnanl function should be immune against changes in the sign bit and + in the mantissa bits. The xor operation twiddles a bit that can only be + a sign bit or a mantissa bit (since the exponent never extends to + bit 31). */ + m.value = NaNl (); + m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); + for (i = 0; i < NWORDS; i++) + m.word[i] |= 1; + if (!isnanl (m.value)) + result |= 1; + } #if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) /* Representation of an 80-bit 'long double' as an initializer for a sequence @@ -185,14 +189,14 @@ static memory_long_double x = { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; if (!isnanl (x.value)) - return 1; + result |= 2; } { /* Signalling NaN. */ static memory_long_double x = { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; if (!isnanl (x.value)) - return 1; + result |= 2; } /* The isnanl function should recognize Pseudo-NaNs, Pseudo-Infinities, Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in @@ -205,35 +209,35 @@ static memory_long_double x = { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; if (!isnanl (x.value)) - return 1; + result |= 4; } { /* Pseudo-Infinity. */ static memory_long_double x = { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; if (!isnanl (x.value)) - return 1; + result |= 8; } { /* Pseudo-Zero. */ static memory_long_double x = { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; if (!isnanl (x.value)) - return 1; + result |= 16; } { /* Unnormalized number. */ static memory_long_double x = { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; if (!isnanl (x.value)) - return 1; + result |= 32; } { /* Pseudo-Denormal. */ static memory_long_double x = { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; if (!isnanl (x.value)) - return 1; + result |= 64; } #endif - return 0; + return result; }]])], [gl_cv_func_isnanl_works=yes], [gl_cv_func_isnanl_works=no],
--- a/m4/ldexpl.m4 +++ b/m4/ldexpl.m4 @@ -1,4 +1,4 @@ -# ldexpl.m4 serial 8 +# ldexpl.m4 serial 9 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -87,11 +87,20 @@ extern long double ldexpl (long double, int); int main() { - volatile long double x1 = 1.0; - volatile long double y1 = ldexpl (x1, -1); - volatile long double x2 = 1.73205L; - volatile long double y2 = ldexpl (x2, 0); - return (y1 != 0.5L) || (y2 != x2); + int result = 0; + { + volatile long double x = 1.0; + volatile long double y = ldexpl (x, -1); + if (y != 0.5L) + result |= 1; + } + { + volatile long double x = 1.73205L; + volatile long double y = ldexpl (x, 0); + if (y != x) + result |= 2; + } + return result; }]])], [gl_cv_func_ldexpl_works=yes], [gl_cv_func_ldexpl_works=no],
--- a/m4/link.m4 +++ b/m4/link.m4 @@ -1,4 +1,4 @@ -# link.m4 serial 4 +# link.m4 serial 5 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -22,10 +22,15 @@ AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <unistd.h> -]], [[if (!link ("conftest.a", "conftest.b/")) return 1; + ]], + [[int result = 0; + if (!link ("conftest.a", "conftest.b/")) + result |= 1; #if HAVE_LSTAT - if (!link ("conftest.lnk/", "conftest.b")) return 2; + if (!link ("conftest.lnk/", "conftest.b")) + result |= 2; #endif + return result; ]])], [gl_cv_func_link_works=yes], [gl_cv_func_link_works=no], [gl_cv_func_link_works="guessing no"])
--- a/m4/linkat.m4 +++ b/m4/linkat.m4 @@ -1,4 +1,4 @@ -# serial 3 +# serial 4 # See if we need to provide linkat replacement. dnl Copyright (C) 2009-2010 Free Software Foundation, Inc. @@ -50,9 +50,8 @@ #include <errno.h> #include <stdio.h> ]], - [[int fd; - int err; - int ret; + [[int result; + int fd; /* Create a regular file. */ fd = open ("conftest.a", O_CREAT | O_EXCL | O_WRONLY, 0600); if (fd < 0) @@ -66,14 +65,15 @@ if (linkat (AT_FDCWD, "conftest.a", AT_FDCWD, "conftest.b", AT_SYMLINK_FOLLOW) < 0) return 0; + result = 0; /* Test whether a trailing "/" is treated like "/.". */ if (linkat (AT_FDCWD, "conftest.a/", AT_FDCWD, "conftest.c", AT_SYMLINK_FOLLOW) == 0) - return 4; + result |= 4; if (linkat (AT_FDCWD, "conftest.a", AT_FDCWD, "conftest.d/", AT_SYMLINK_FOLLOW) == 0) - return 5; - return 0; + result |= 8; + return result; ]])], [gl_cv_func_linkat_slash=yes], [gl_cv_func_linkat_slash=no],
--- a/m4/mbrlen.m4 +++ b/m4/mbrlen.m4 @@ -1,4 +1,4 @@ -# mbrlen.m4 serial 3 +# mbrlen.m4 serial 4 dnl Copyright (C) 2008, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -110,6 +110,7 @@ #include <wchar.h> int main () { + int result = 0; /* This fails on Solaris. */ if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { @@ -121,7 +122,7 @@ { input[1] = '\0'; if (mbrlen (input + 2, 5, &state) != 1) - return 1; + result |= 1; } } /* This fails on HP-UX 11.11. */ @@ -135,10 +136,10 @@ { input[1] = '\0'; if (mbrlen (input + 2, 5, &state) != 2) - return 1; + result |= 2; } } - return 0; + return result; }]])], [gl_cv_func_mbrlen_retval=yes], [gl_cv_func_mbrlen_retval=no],
--- a/m4/mbrtowc.m4 +++ b/m4/mbrtowc.m4 @@ -1,4 +1,4 @@ -# mbrtowc.m4 serial 18 +# mbrtowc.m4 serial 19 dnl Copyright (C) 2001-2002, 2004-2005, 2008-2010 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -271,6 +271,7 @@ #include <wchar.h> int main () { + int result = 0; /* This fails on Solaris. */ if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { @@ -283,7 +284,7 @@ { input[1] = '\0'; if (mbrtowc (&wc, input + 2, 5, &state) != 1) - return 1; + result |= 1; } } /* This fails on HP-UX 11.11. */ @@ -298,10 +299,10 @@ { input[1] = '\0'; if (mbrtowc (&wc, input + 2, 5, &state) != 2) - return 1; + result |= 2; } } - return 0; + return result; }]])], [gl_cv_func_mbrtowc_retval=yes], [gl_cv_func_mbrtowc_retval=no],
--- a/m4/mbsrtowcs.m4 +++ b/m4/mbsrtowcs.m4 @@ -1,4 +1,4 @@ -# mbsrtowcs.m4 serial 7 +# mbsrtowcs.m4 serial 8 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -64,6 +64,7 @@ #include <wchar.h> int main () { + int result = 0; /* Test whether the function works when started with a conversion state in non-initial state. This fails on HP-UX 11.11 and Solaris 10. */ if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) @@ -77,7 +78,7 @@ { const char *src = input + 2; if (mbsrtowcs (NULL, &src, 10, &state) != 4) - return 1; + result |= 1; } } if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) @@ -91,7 +92,7 @@ { const char *src = input + 4; if (mbsrtowcs (NULL, &src, 10, &state) != 3) - return 1; + result |= 2; } } if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) @@ -105,10 +106,10 @@ { const char *src = input + 2; if (mbsrtowcs (NULL, &src, 10, &state) != 4) - return 1; + result |= 4; } } - return 0; + return result; }]])], [gl_cv_func_mbsrtowcs_works=yes], [gl_cv_func_mbsrtowcs_works=no],
--- a/m4/memchr.m4 +++ b/m4/memchr.m4 @@ -1,4 +1,4 @@ -# memchr.m4 serial 9 +# memchr.m4 serial 10 dnl Copyright (C) 2002-2004, 2009-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -35,6 +35,7 @@ # endif #endif ]], [[ + int result = 0; char *fence = NULL; #if HAVE_SYS_MMAN_H && HAVE_MPROTECT # if HAVE_MAP_ANONYMOUS @@ -58,14 +59,14 @@ if (fence) { if (memchr (fence, 0, 0)) - return 1; + result |= 1; strcpy (fence - 9, "12345678"); if (memchr (fence - 9, 0, 79) != fence - 1) - return 2; + result |= 2; if (memchr (fence - 1, 0, 3) != fence - 1) - return 3; + result |= 4; } - return 0; + return result; ]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no], [dnl Be pessimistic for now. gl_cv_func_memchr_works="guessing no"])])
--- a/m4/memmem.m4 +++ b/m4/memmem.m4 @@ -1,4 +1,4 @@ -# memmem.m4 serial 19 +# memmem.m4 serial 20 dnl Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009, 2010 Free Software dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -73,10 +73,11 @@ #include <stdlib.h> /* for malloc */ #include <unistd.h> /* for alarm */ static void quit (int sig) { exit (sig + 128); } -]], [[size_t m = 1000000; +]], [[ + int result = 0; + size_t m = 1000000; char *haystack = (char *) malloc (2 * m + 1); char *needle = (char *) malloc (m + 1); - void *result = 0; /* Failure to compile this test due to missing alarm is okay, since all such platforms (mingw) also lack memmem. */ signal (SIGALRM, quit); @@ -88,10 +89,14 @@ haystack[2 * m] = 'B'; memset (needle, 'A', m); needle[m] = 'B'; - result = memmem (haystack, 2 * m + 1, needle, m + 1); + if (!memmem (haystack, 2 * m + 1, needle, m + 1)) + result |= 1; } /* Check for empty needle behavior. */ - return !result || !memmem ("a", 1, 0, 0);]])], + if (!memmem ("a", 1, 0, 0)) + result |= 2; + return result; + ]])], [gl_cv_func_memmem_works_fast=yes], [gl_cv_func_memmem_works_fast=no], [dnl Only glibc > 2.12 and cygwin > 1.7.7 are known to have a dnl bug-free memmem that works in linear time.
--- a/m4/mkfifo.m4 +++ b/m4/mkfifo.m4 @@ -1,4 +1,4 @@ -# serial 1 +# serial 2 # See if we need to provide mkfifo replacement. dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. @@ -27,10 +27,15 @@ AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/stat.h> -]], [[if (!mkfifo ("conftest.tmp/", 0600)) return 1; + ]], + [[int result = 0; + if (!mkfifo ("conftest.tmp/", 0600)) + result |= 1; #if HAVE_LSTAT - if (!mkfifo ("conftest.lnk/", 0600)) return 2; + if (!mkfifo ("conftest.lnk/", 0600)) + result |= 2; #endif + return result; ]])], [gl_cv_func_mkfifo_works=yes], [gl_cv_func_mkfifo_works=no], [gl_cv_func_mkfifo_works="guessing no"])
--- a/m4/mkstemp.m4 +++ b/m4/mkstemp.m4 @@ -1,4 +1,4 @@ -#serial 18 +#serial 19 # Copyright (C) 2001, 2003-2007, 2009-2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -25,7 +25,8 @@ AC_RUN_IFELSE( [AC_LANG_PROGRAM( [AC_INCLUDES_DEFAULT], - [[int i; + [[int result = 0; + int i; off_t large = (off_t) 4294967295u; if (large < 0) large = 2147483647; @@ -34,11 +35,16 @@ char templ[] = "conftest.mkstemp/coXXXXXX"; int (*mkstemp_function) (char *) = mkstemp; int fd = mkstemp_function (templ); - if (fd < 0 || lseek (fd, large, SEEK_SET) != large) - return 1; - close (fd); + if (fd < 0) + result |= 1; + else + { + if (lseek (fd, large, SEEK_SET) != large) + result |= 2; + close (fd); + } } - return 0;]])], + return result;]])], [gl_cv_func_working_mkstemp=yes], [gl_cv_func_working_mkstemp=no], [gl_cv_func_working_mkstemp=no])
--- a/m4/mktime.m4 +++ b/m4/mktime.m4 @@ -1,4 +1,4 @@ -# serial 16 +# serial 17 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2010 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -162,6 +162,7 @@ int main () { + int result = 0; time_t t, delta; int i, j; @@ -187,21 +188,27 @@ for (t = 0; t <= time_t_max - delta; t += delta) if (! mktime_test (t)) - return 1; + result |= 1; if (! (mktime_test ((time_t) 1) && mktime_test ((time_t) (60 * 60)) && mktime_test ((time_t) (60 * 60 * 24)))) - return 1; + result |= 2; for (j = 1; ; j <<= 1) if (! bigtime_test (j)) - return 1; + result |= 4; else if (INT_MAX / 2 < j) break; if (! bigtime_test (INT_MAX)) - return 1; + result |= 8; } - return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ()); + if (! irix_6_4_bug ()) + result |= 16; + if (! spring_forward_gap ()) + result |= 32; + if (! year_2050_test ()) + result |= 64; + return result; }]])], [ac_cv_func_working_mktime=yes], [ac_cv_func_working_mktime=no],
--- a/m4/nanosleep.m4 +++ b/m4/nanosleep.m4 @@ -1,4 +1,4 @@ -# serial 31 +# serial 32 dnl From Jim Meyering. dnl Check for the nanosleep function. @@ -74,7 +74,7 @@ static struct timespec ts_remaining; static struct sigaction act; if (! nanosleep) - return 1; + return 2; act.sa_handler = check_for_SIGALRM; sigemptyset (&act.sa_mask); sigaction (SIGALRM, &act, NULL); @@ -82,18 +82,21 @@ ts_sleep.tv_nsec = 1; alarm (1); if (nanosleep (&ts_sleep, NULL) != 0) - return 1; + return 3; ts_sleep.tv_sec = TYPE_MAXIMUM (time_t); ts_sleep.tv_nsec = 999999999; alarm (1); - if (nanosleep (&ts_sleep, &ts_remaining) == -1 && errno == EINTR - && TYPE_MAXIMUM (time_t) - 10 < ts_remaining.tv_sec) - return 0; - return 119; + if (nanosleep (&ts_sleep, &ts_remaining) != -1) + return 4; + if (errno != EINTR) + return 5; + if (ts_remaining.tv_sec <= TYPE_MAXIMUM (time_t) - 10) + return 6; + return 0; }]])], [gl_cv_func_nanosleep=yes], [case $? in dnl ( - 119) gl_cv_func_nanosleep='no (mishandles large arguments)';; dnl ( + 4|5|6) gl_cv_func_nanosleep='no (mishandles large arguments)';; dnl ( *) gl_cv_func_nanosleep=no;; esac], [gl_cv_func_nanosleep=cross-compiling])
--- a/m4/open.m4 +++ b/m4/open.m4 @@ -1,4 +1,4 @@ -# open.m4 serial 9 +# open.m4 serial 10 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -30,10 +30,14 @@ #endif int main () { + int result = 0; #if HAVE_LSTAT - if (open ("conftest.lnk/", O_RDONLY) != -1) return 2; + if (open ("conftest.lnk/", O_RDONLY) != -1) + result |= 1; #endif - return open ("conftest.sl/", O_CREAT, 0600) >= 0; + if (open ("conftest.sl/", O_CREAT, 0600) >= 0) + result |= 2; + return result; }]])], [gl_cv_func_open_slash=yes], [gl_cv_func_open_slash=no],
--- a/m4/poll.m4 +++ b/m4/poll.m4 @@ -1,4 +1,4 @@ -# poll.m4 serial 11 +# poll.m4 serial 12 dnl Copyright (c) 2003, 2005, 2006, 2007, 2009, 2010 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -20,27 +20,30 @@ #include <poll.h> int main() { + int result = 0; struct pollfd ufd; /* Try /dev/null for reading. */ ufd.fd = open ("/dev/null", O_RDONLY); - if (ufd.fd < 0) - /* If /dev/null does not exist, it's not MacOS X nor AIX. */ - return 0; - ufd.events = POLLIN; - ufd.revents = 0; - if (!(poll (&ufd, 1, 0) == 1 && ufd.revents == POLLIN)) - return 1; + /* If /dev/null does not exist, it's not MacOS X nor AIX. */ + if (ufd.fd >= 0) + { + ufd.events = POLLIN; + ufd.revents = 0; + if (!(poll (&ufd, 1, 0) == 1 && ufd.revents == POLLIN)) + result |= 1; + } /* Try /dev/null for writing. */ ufd.fd = open ("/dev/null", O_WRONLY); - if (ufd.fd < 0) - /* If /dev/null does not exist, it's not MacOS X nor AIX. */ - return 0; - ufd.events = POLLOUT; - ufd.revents = 0; - if (!(poll (&ufd, 1, 0) == 1 && ufd.revents == POLLOUT)) - return 1; + /* If /dev/null does not exist, it's not MacOS X nor AIX. */ + if (ufd.fd >= 0) + { + ufd.events = POLLOUT; + ufd.revents = 0; + if (!(poll (&ufd, 1, 0) == 1 && ufd.revents == POLLOUT)) + result |= 2; + } /* Trying /dev/tty may be too environment dependent. */ - return 0; + return result; }]])], [gl_cv_func_poll=yes], [gl_cv_func_poll=no],
--- a/m4/popen.m4 +++ b/m4/popen.m4 @@ -1,4 +1,4 @@ -# popen.m4 serial 2 +# popen.m4 serial 3 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,11 +11,16 @@ [gl_cv_func_popen_works], [ AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h> -]], [FILE *child; +]], [int result = 0; + FILE *child; fclose (stdin); fclose (stdout); child = popen ("echo a", "r"); - return !(fgetc (child) == 'a' && pclose (child) == 0); + if (fgetc (child) != 'a') + result |= 1; + if (pclose (child) != 0) + result |= 2; + return result; ])], [gl_cv_func_popen_works=yes], [gl_cv_func_popen_works=no], dnl For now, only cygwin 1.5 or older is known to be broken. [gl_cv_func_popen_works='guessing yes'])
--- a/m4/posix_spawn.m4 +++ b/m4/posix_spawn.m4 @@ -1,4 +1,4 @@ -# posix_spawn.m4 serial 7 +# posix_spawn.m4 serial 8 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -291,7 +291,7 @@ if (fflush (fp) || fclose (fp)) { perror ("cannot prepare data file"); - return 1; + return 2; } /* Avoid reading from our stdin, as it could block. */ @@ -309,7 +309,7 @@ posix_spawn_file_actions_destroy (&actions); errno = err; perror ("subprocess failed"); - return 1; + return 3; } posix_spawn_file_actions_destroy (&actions); status = 0; @@ -318,13 +318,13 @@ if (!WIFEXITED (status)) { fprintf (stderr, "subprocess terminated with unexpected wait status %d\n", status); - return 1; + return 4; } exitstatus = WEXITSTATUS (status); if (exitstatus != 0) { fprintf (stderr, "subprocess terminated with unexpected exit status %d\n", exitstatus); - return 1; + return 5; } return 0; } @@ -339,7 +339,7 @@ && memcmp (buf, "Halle Potta", 11) == 0) return 0; else - return 2; + return 8; } static void
--- a/m4/printf.m4 +++ b/m4/printf.m4 @@ -1,4 +1,4 @@ -# printf.m4 serial 39 +# printf.m4 serial 40 dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -32,25 +32,26 @@ static char buf[100]; int main () { + int result = 0; #if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX buf[0] = '\0'; if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 || strcmp (buf, "12345671 33") != 0) - return 1; + result |= 1; #endif buf[0] = '\0'; if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 || strcmp (buf, "12345672 33") != 0) - return 1; + result |= 2; buf[0] = '\0'; if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0 || strcmp (buf, "12345673 33") != 0) - return 1; + result |= 4; buf[0] = '\0'; if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0 || strcmp (buf, "1.5 33") != 0) - return 1; - return 0; + result |= 8; + return result; }]])], [gl_cv_func_printf_sizes_c99=yes], [gl_cv_func_printf_sizes_c99=no], @@ -102,19 +103,20 @@ static char buf[10000]; int main () { + int result = 0; buf[0] = '\0'; if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 || strcmp (buf, "1.750000 33") != 0) - return 1; + result |= 1; buf[0] = '\0'; if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 || strcmp (buf, "1.750000e+00 33") != 0) - return 1; + result |= 2; buf[0] = '\0'; if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 || strcmp (buf, "1.75 33") != 0) - return 1; - return 0; + result |= 4; + return result; }]])], [gl_cv_func_printf_long_double=yes], [gl_cv_func_printf_long_double=no], @@ -175,39 +177,40 @@ static double zero = 0.0; int main () { + int result = 0; if (sprintf (buf, "%f", 1.0 / 0.0) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - return 1; + result |= 1; if (sprintf (buf, "%f", -1.0 / 0.0) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - return 1; + result |= 1; if (sprintf (buf, "%f", zero / zero) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 2; if (sprintf (buf, "%e", 1.0 / 0.0) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - return 1; + result |= 4; if (sprintf (buf, "%e", -1.0 / 0.0) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - return 1; + result |= 4; if (sprintf (buf, "%e", zero / zero) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 8; if (sprintf (buf, "%g", 1.0 / 0.0) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - return 1; + result |= 16; if (sprintf (buf, "%g", -1.0 / 0.0) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - return 1; + result |= 16; if (sprintf (buf, "%g", zero / zero) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 32; /* This test fails on HP-UX 10.20. */ if (have_minus_zero ()) if (sprintf (buf, "%g", - zero) < 0 || strcmp (buf, "-0") != 0) - return 1; - return 0; + result |= 64; + return result; }]])], [gl_cv_func_printf_infinite=yes], [gl_cv_func_printf_infinite=no], @@ -289,34 +292,35 @@ static long double zeroL = 0.0L; int main () { + int result = 0; nocrash_init(); if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - return 1; + result |= 1; if (sprintf (buf, "%Lf", -1.0L / 0.0L) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - return 1; + result |= 1; if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 1; if (sprintf (buf, "%Le", 1.0L / 0.0L) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - return 1; + result |= 1; if (sprintf (buf, "%Le", -1.0L / 0.0L) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - return 1; + result |= 1; if (sprintf (buf, "%Le", zeroL / zeroL) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 1; if (sprintf (buf, "%Lg", 1.0L / 0.0L) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - return 1; + result |= 1; if (sprintf (buf, "%Lg", -1.0L / 0.0L) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - return 1; + result |= 1; if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 1; #if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) /* Representation of an 80-bit 'long double' as an initializer for a sequence of 'unsigned int' words. */ @@ -335,13 +339,13 @@ { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 2; if (sprintf (buf, "%Le", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 2; if (sprintf (buf, "%Lg", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 2; } { /* Signalling NaN. */ @@ -349,81 +353,81 @@ { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 2; if (sprintf (buf, "%Le", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 2; if (sprintf (buf, "%Lg", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 2; } { /* Pseudo-NaN. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 4; if (sprintf (buf, "%Le", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 4; if (sprintf (buf, "%Lg", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 4; } { /* Pseudo-Infinity. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 8; if (sprintf (buf, "%Le", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 8; if (sprintf (buf, "%Lg", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 8; } { /* Pseudo-Zero. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 16; if (sprintf (buf, "%Le", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 16; if (sprintf (buf, "%Lg", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 16; } { /* Unnormalized number. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 32; if (sprintf (buf, "%Le", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 32; if (sprintf (buf, "%Lg", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 32; } { /* Pseudo-Denormal. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 64; if (sprintf (buf, "%Le", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 64; if (sprintf (buf, "%Lg", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 64; } #endif - return 0; + return result; }]])], [gl_cv_func_printf_infinite_long_double=yes], [gl_cv_func_printf_infinite_long_double=no], @@ -476,37 +480,38 @@ static char buf[100]; int main () { + int result = 0; if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 || (strcmp (buf, "0x1.922p+1 33") != 0 && strcmp (buf, "0x3.244p+0 33") != 0 && strcmp (buf, "0x6.488p-1 33") != 0 && strcmp (buf, "0xc.91p-2 33") != 0)) - return 1; + result |= 1; if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 || (strcmp (buf, "-0X1.922P+1 33") != 0 && strcmp (buf, "-0X3.244P+0 33") != 0 && strcmp (buf, "-0X6.488P-1 33") != 0 && strcmp (buf, "-0XC.91P-2 33") != 0)) - return 1; + result |= 2; /* This catches a FreeBSD 6.1 bug: it doesn't round. */ if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 || (strcmp (buf, "0x1.83p+0 33") != 0 && strcmp (buf, "0x3.05p-1 33") != 0 && strcmp (buf, "0x6.0ap-2 33") != 0 && strcmp (buf, "0xc.14p-3 33") != 0)) - return 1; + result |= 4; /* This catches a FreeBSD 6.1 bug. See <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */ if (sprintf (buf, "%010a %d", 1.0 / 0.0, 33, 44, 55) < 0 || buf[0] == '0') - return 1; + result |= 8; /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug. */ if (sprintf (buf, "%.1a", 1.999) < 0 || (strcmp (buf, "0x1.0p+1") != 0 && strcmp (buf, "0x2.0p+0") != 0 && strcmp (buf, "0x4.0p-1") != 0 && strcmp (buf, "0x8.0p-2") != 0)) - return 1; + result |= 16; /* This catches the same MacOS X 10.3.9 (Darwin 7.9) bug and also a glibc 2.4 bug <http://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */ if (sprintf (buf, "%.1La", 1.999L) < 0 @@ -514,8 +519,8 @@ && strcmp (buf, "0x2.0p+0") != 0 && strcmp (buf, "0x4.0p-1") != 0 && strcmp (buf, "0x8.0p-2") != 0)) - return 1; - return 0; + result |= 32; + return result; }]])], [gl_cv_func_printf_directive_a=yes], [gl_cv_func_printf_directive_a=no], @@ -559,17 +564,18 @@ static char buf[100]; int main () { + int result = 0; if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 || strcmp (buf, "1234567.000000 33") != 0) - return 1; + result |= 1; if (sprintf (buf, "%F", 1.0 / 0.0) < 0 || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) - return 1; + result |= 2; /* This catches a Cygwin 1.5.x bug. */ if (sprintf (buf, "%.F", 1234.0) < 0 || strcmp (buf, "1234") != 0) - return 1; - return 0; + result |= 4; + return result; }]])], [gl_cv_func_printf_directive_f=yes], [gl_cv_func_printf_directive_f=no], @@ -664,6 +670,7 @@ #include <string.h> int main () { + int result = 0; char buf[100]; /* Test whether %ls works at all. This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on @@ -673,7 +680,7 @@ buf[0] = '\0'; if (sprintf (buf, "%ls", wstring) < 0 || strcmp (buf, "abc") != 0) - return 1; + result |= 1; } /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an assertion failure inside libc), but not on OpenBSD 4.0. */ @@ -682,7 +689,7 @@ buf[0] = '\0'; if (sprintf (buf, "%ls", wstring) < 0 || strcmp (buf, "a") != 0) - return 1; + result |= 2; } /* Test whether precisions in %ls are supported as specified in ISO C 99 section 7.19.6.1: @@ -697,9 +704,9 @@ buf[0] = '\0'; if (sprintf (buf, "%.2ls", wstring) < 0 || strcmp (buf, "ab") != 0) - return 1; + result |= 8; } - return 0; + return result; }]])], [gl_cv_func_printf_directive_ls=yes], [gl_cv_func_printf_directive_ls=no], @@ -901,15 +908,16 @@ static char buf[5000]; int main () { + int result = 0; #ifdef __BEOS__ /* On BeOS, this would crash and show a dialog box. Avoid the crash. */ return 1; #endif if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3) - return 1; + result |= 1; if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5) - return 2; - return 0; + result |= 2; + return result; }]])], [gl_cv_func_printf_precision=yes], [gl_cv_func_printf_precision=no],
--- a/m4/putenv.m4 +++ b/m4/putenv.m4 @@ -1,4 +1,4 @@ -# putenv.m4 serial 16 +# putenv.m4 serial 17 dnl Copyright (C) 2002-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -21,11 +21,11 @@ /* Try to remove it. */ if (putenv ("CONFTEST_putenv")) - return 1; + return 2; /* Make sure it was deleted. */ if (getenv ("CONFTEST_putenv") != 0) - return 1; + return 3; return 0; ]])],
--- a/m4/regex.m4 +++ b/m4/regex.m4 @@ -1,4 +1,4 @@ -# serial 56 +# serial 57 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010 Free Software Foundation, Inc. @@ -41,7 +41,8 @@ #include <limits.h> #include <regex.h> ]], - [[static struct re_pattern_buffer regex; + [[int result = 0; + static struct re_pattern_buffer regex; unsigned char folded_chars[UCHAR_MAX + 1]; int i; const char *s; @@ -63,11 +64,11 @@ memset (®ex, 0, sizeof regex); s = re_compile_pattern (pat, sizeof pat - 1, ®ex); if (s) - return 1; - if (re_search (®ex, data, sizeof data - 1, - 0, sizeof data - 1, ®s) - != -1) - return 1; + result |= 1; + else if (re_search (®ex, data, sizeof data - 1, + 0, sizeof data - 1, ®s) + != -1) + result |= 1; if (! setlocale (LC_ALL, "C")) return 1; } @@ -78,11 +79,10 @@ memset (®ex, 0, sizeof regex); s = re_compile_pattern ("a[^x]b", 6, ®ex); if (s) - return 1; - + result |= 2; /* This should fail, but succeeds for glibc-2.5. */ - if (re_search (®ex, "a\nb", 3, 0, 3, ®s) != -1) - return 1; + else if (re_search (®ex, "a\nb", 3, 0, 3, ®s) != -1) + result |= 2; /* This regular expression is from Spencer ere test number 75 in grep-2.3. */ @@ -94,7 +94,7 @@ s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, ®ex); /* This should fail with _Invalid character class name_ error. */ if (!s) - return 1; + result |= 4; /* Ensure that [b-a] is diagnosed as invalid, when using RE_NO_EMPTY_RANGES. */ @@ -102,34 +102,31 @@ memset (®ex, 0, sizeof regex); s = re_compile_pattern ("a[b-a]", 6, ®ex); if (s == 0) - return 1; + result |= 8; /* This should succeed, but does not for glibc-2.1.3. */ memset (®ex, 0, sizeof regex); s = re_compile_pattern ("{1", 2, ®ex); - if (s) - return 1; + result |= 8; /* The following example is derived from a problem report against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */ memset (®ex, 0, sizeof regex); s = re_compile_pattern ("[an\371]*n", 7, ®ex); if (s) - return 1; - + result |= 8; /* This should match, but does not for glibc-2.2.1. */ - if (re_match (®ex, "an", 2, 0, ®s) != 2) - return 1; + else if (re_match (®ex, "an", 2, 0, ®s) != 2) + result |= 8; memset (®ex, 0, sizeof regex); s = re_compile_pattern ("x", 1, ®ex); if (s) - return 1; - + result |= 8; /* glibc-2.2.93 does not work with a negative RANGE argument. */ - if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) - return 1; + else if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) + result |= 8; /* The version of regex.c in older versions of gnulib ignored RE_ICASE. Detect that problem too. */ @@ -137,10 +134,9 @@ memset (®ex, 0, sizeof regex); s = re_compile_pattern ("x", 1, ®ex); if (s) - return 1; - - if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) - return 1; + result |= 16; + else if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) + result |= 16; /* Catch a bug reported by Vin Shelton in http://lists.gnu.org/archive/html/bug-coreutils/2007-06/msg00089.html @@ -151,12 +147,12 @@ memset (®ex, 0, sizeof regex); s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, ®ex); if (s) - return 1; + result |= 32; /* REG_STARTEND was added to glibc on 2004-01-15. Reject older versions. */ if (! REG_STARTEND) - return 1; + result |= 64; #if 0 /* It would be nice to reject hosts whose regoff_t values are too @@ -167,10 +163,11 @@ when compiling --without-included-regex. */ if (sizeof (regoff_t) < sizeof (ptrdiff_t) || sizeof (regoff_t) < sizeof (ssize_t)) - return 1; + result |= 64; #endif - return 0;]])], + return result; + ]])], [gl_cv_func_re_compile_pattern_working=yes], [gl_cv_func_re_compile_pattern_working=no], dnl When crosscompiling, assume it is not working.
--- a/m4/rename.m4 +++ b/m4/rename.m4 @@ -1,4 +1,4 @@ -# serial 22 +# serial 23 # Copyright (C) 2001, 2003, 2005-2006, 2009-2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -28,27 +28,34 @@ dnl links are also broken. AC_CACHE_CHECK([whether rename honors trailing slash on destination], [gl_cv_func_rename_slash_dst_works], - [rm -rf conftest.f conftest.f1 conftest.d1 conftest.d2 conftest.lnk - touch conftest.f && mkdir conftest.d1 || + [rm -rf conftest.f conftest.f1 conftest.f2 conftest.d1 conftest.d2 conftest.lnk + touch conftest.f && touch conftest.f1 && mkdir conftest.d1 || AC_MSG_ERROR([cannot create temporary files]) # Assume that if we have lstat, we can also check symlinks. if test $ac_cv_func_lstat = yes; then ln -s conftest.f conftest.lnk fi - AC_RUN_IFELSE([AC_LANG_PROGRAM([[ -# include <stdio.h> -# include <stdlib.h> -]], [if (rename ("conftest.f", "conftest.f1/") == 0) return 1; - if (rename ("conftest.d1", "conftest.d2/") != 0) return 2; + AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ +# include <stdio.h> +# include <stdlib.h> + ]], + [[int result = 0; + if (rename ("conftest.f1", "conftest.f2/") == 0) + result |= 1; + if (rename ("conftest.d1", "conftest.d2/") != 0) + result |= 2; #if HAVE_LSTAT - if (rename ("conftest.f", "conftest.lnk/") == 0) return 3; + if (rename ("conftest.f", "conftest.lnk/") == 0) + result |= 4; #endif - ])], + return result; + ]])], [gl_cv_func_rename_slash_dst_works=yes], [gl_cv_func_rename_slash_dst_works=no], dnl When crosscompiling, assume rename is broken. [gl_cv_func_rename_slash_dst_works="guessing no"]) - rm -rf conftest.f conftest.f1 conftest.d1 conftest.d2 conftest.lnk + rm -rf conftest.f conftest.f1 conftest.f2 conftest.d1 conftest.d2 conftest.lnk ]) if test "x$gl_cv_func_rename_slash_dst_works" != xyes; then AC_LIBOBJ([rename]) @@ -65,27 +72,34 @@ dnl symlinks with a trailing slash. AC_CACHE_CHECK([whether rename honors trailing slash on source], [gl_cv_func_rename_slash_src_works], - [rm -rf conftest.f conftest.d1 conftest.d2 conftest.lnk - touch conftest.f && mkdir conftest.d1 || + [rm -rf conftest.f conftest.f1 conftest.d1 conftest.d2 conftest.d3 conftest.lnk + touch conftest.f && touch conftest.f1 && mkdir conftest.d1 || AC_MSG_ERROR([cannot create temporary files]) # Assume that if we have lstat, we can also check symlinks. if test $ac_cv_func_lstat = yes; then ln -s conftest.f conftest.lnk fi - AC_RUN_IFELSE([AC_LANG_PROGRAM([[ -# include <stdio.h> -# include <stdlib.h> -]], [if (rename ("conftest.f/", "conftest.d2") == 0) return 1; - if (rename ("conftest.d1/", "conftest.d2") != 0) return 2; + AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ +# include <stdio.h> +# include <stdlib.h> + ]], + [[int result = 0; + if (rename ("conftest.f1/", "conftest.d3") == 0) + result |= 1; + if (rename ("conftest.d1/", "conftest.d2") != 0) + result |= 2; #if HAVE_LSTAT - if (rename ("conftest.lnk/", "conftest.f") == 0) return 3; + if (rename ("conftest.lnk/", "conftest.f") == 0) + result |= 4; #endif - ])], + return result; + ]])], [gl_cv_func_rename_slash_src_works=yes], [gl_cv_func_rename_slash_src_works=no], dnl When crosscompiling, assume rename is broken. [gl_cv_func_rename_slash_src_works="guessing no"]) - rm -rf conftest.f conftest.d1 conftest.d2 conftest.lnk + rm -rf conftest.f conftest.f1 conftest.d1 conftest.d2 conftest.d3 conftest.lnk ]) if test "x$gl_cv_func_rename_slash_src_works" != xyes; then AC_LIBOBJ([rename]) @@ -103,14 +117,23 @@ [rm -rf conftest.f conftest.f1 if touch conftest.f && ln conftest.f conftest.f1 && set x `ls -i conftest.f conftest.f1` && test "$2" = "$4"; then - AC_RUN_IFELSE([AC_LANG_PROGRAM([[ -# include <stdio.h> -# include <stdlib.h> -# include <unistd.h> -]], [if (rename ("conftest.f", "conftest.f1")) return 1; - if (unlink ("conftest.f1")) return 2; - if (rename ("conftest.f", "conftest.f")) return 3; - if (rename ("conftest.f1", "conftest.f1") == 0) return 4;])], + AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ +# include <stdio.h> +# include <stdlib.h> +# include <unistd.h> + ]], + [[int result = 0; + if (rename ("conftest.f", "conftest.f1")) + result |= 1; + if (unlink ("conftest.f1")) + result |= 2; + if (rename ("conftest.f", "conftest.f")) + result |= 4; + if (rename ("conftest.f1", "conftest.f1") == 0) + result |= 8; + return result; + ]])], [gl_cv_func_rename_link_works=yes], [gl_cv_func_rename_link_works=no], dnl When crosscompiling, assume rename is broken. @@ -137,11 +160,18 @@ [rm -rf conftest.f conftest.d1 conftest.d2 touch conftest.f && mkdir conftest.d1 conftest.d2 || AC_MSG_ERROR([cannot create temporary files]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([[ -# include <stdio.h> -# include <stdlib.h> -]], [if (rename ("conftest.d1", "conftest.d2") != 0) return 1; - if (rename ("conftest.d2", "conftest.f") == 0) return 2;])], + AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ +# include <stdio.h> +# include <stdlib.h> + ]], + [[int result = 0; + if (rename ("conftest.d1", "conftest.d2") != 0) + result |= 1; + if (rename ("conftest.d2", "conftest.f") == 0) + result |= 2; + return result; + ]])], [gl_cv_func_rename_dest_works=yes], [gl_cv_func_rename_dest_works=no], dnl When crosscompiling, assume rename is broken.
--- a/m4/rmdir.m4 +++ b/m4/rmdir.m4 @@ -1,4 +1,4 @@ -# rmdir.m4 serial 8 +# rmdir.m4 serial 9 dnl Copyright (C) 2002, 2005, 2009-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -17,8 +17,15 @@ [[#include <stdio.h> #include <errno.h> #include <unistd.h> -]], [[return !rmdir ("conftest.file/") || errno != ENOTDIR - || !rmdir ("conftest.dir/./");]])], +]], [[int result = 0; + if (!rmdir ("conftest.file/")) + result |= 1; + else if (errno != ENOTDIR) + result |= 2; + if (!rmdir ("conftest.dir/./")) + result |= 4; + return result; + ]])], [gl_cv_func_rmdir_works=yes], [gl_cv_func_rmdir_works=no], [gl_cv_func_rmdir_works="guessing no"]) rm -rf conftest.dir conftest.file])
--- a/m4/setenv.m4 +++ b/m4/setenv.m4 @@ -1,4 +1,4 @@ -# setenv.m4 serial 18 +# setenv.m4 serial 19 dnl Copyright (C) 2001-2004, 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -27,10 +27,20 @@ #include <errno.h> #include <string.h> ]], [[ - if (setenv ("", "", 0) != -1) return 1; - if (errno != EINVAL) return 2; - if (setenv ("a", "=", 1) != 0) return 3; - if (strcmp (getenv ("a"), "=") != 0) return 4; + int result = 0; + { + if (setenv ("", "", 0) != -1) + result |= 1; + else if (errno != EINVAL) + result |= 2; + } + { + if (setenv ("a", "=", 1) != 0) + result |= 4; + else if (strcmp (getenv ("a"), "=") != 0) + result |= 8; + } + return result; ]])], [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no], [gl_cv_func_setenv_works="guessing no"])])
--- a/m4/signbit.m4 +++ b/m4/signbit.m4 @@ -1,4 +1,4 @@ -# signbit.m4 serial 7 +# signbit.m4 serial 8 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -160,7 +160,8 @@ #else long double m0l = -p0l; #endif - if (signbit (vf)) + int result = 0; + if (signbit (vf)) /* link check */ vf++; { float plus_inf = 1.0f / p0f; @@ -171,9 +172,9 @@ && (memcmp (&m0f, &p0f, sizeof (float)) == 0 || signbit (m0f)) && !signbit (plus_inf) && signbit (minus_inf))) - return 1; + result |= 1; } - if (signbit (vd)) + if (signbit (vd)) /* link check */ vd++; { double plus_inf = 1.0 / p0d; @@ -184,22 +185,27 @@ && (memcmp (&m0d, &p0d, sizeof (double)) == 0 || signbit (m0d)) && !signbit (plus_inf) && signbit (minus_inf))) - return 1; + result |= 2; } - if (signbit (vl)) + if (signbit (vl)) /* link check */ vl++; { long double plus_inf = 1.0L / p0l; long double minus_inf = -1.0L / p0l; - if (!(!signbit (255.0L) - && signbit (-255.0L) - && !signbit (p0l) - && (memcmp (&m0l, &p0l, sizeof (long double)) == 0 || signbit (m0l)) - && !signbit (plus_inf) - && signbit (minus_inf))) - return 1; + if (signbit (255.0L)) + result |= 4; + if (!signbit (-255.0L)) + result |= 4; + if (signbit (p0l)) + result |= 8; + if (!(memcmp (&m0l, &p0l, sizeof (long double)) == 0 || signbit (m0l))) + result |= 16; + if (signbit (plus_inf)) + result |= 32; + if (!signbit (minus_inf)) + result |= 64; } - return 0; + return result; } ]]) @@ -249,7 +255,7 @@ { /* More than one bit difference. */ fprintf (fp, "unknown"); - return 1; + return 2; } if (x) { @@ -261,7 +267,7 @@ { /* No difference. */ fprintf (fp, "unknown"); - return 1; + return 3; } /* Now m = plus.word[k] ^ ~minus.word[k]. */ if (plus.word[k] & ~minus.word[k]) @@ -269,13 +275,15 @@ /* Oh? The sign bit is set in the positive and cleared in the negative numbers? */ fprintf (fp, "unknown"); - return 1; + return 4; } for (i = 0; ; i++) if ((m >> i) & 1) break; fprintf (fp, "word %d bit %d", (int) k, (int) i); - return (fclose (fp) != 0); + if (fclose (fp) != 0) + return 5; + return 0; } ]])], [$2=`cat conftest.out`],
--- a/m4/sleep.m4 +++ b/m4/sleep.m4 @@ -1,4 +1,4 @@ -# sleep.m4 serial 3 +# sleep.m4 serial 4 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -38,7 +38,12 @@ signal (SIGALRM, handle_alarm); alarm (1); remaining = sleep (pentecost); - return !(pentecost - 10 < remaining && remaining <= pentecost);]])], + if (remaining > pentecost) + return 3; + if (remaining <= pentecost - 10) + return 4; + return 0; + ]])], [gl_cv_func_sleep_works=yes], [gl_cv_func_sleep_works=no], [gl_cv_func_sleep_works="guessing no"])]) if test "$gl_cv_func_sleep_works" != yes; then
--- a/m4/stat.m4 +++ b/m4/stat.m4 @@ -1,4 +1,4 @@ -# serial 5 +# serial 6 # Copyright (C) 2009, 2010 Free Software Foundation, Inc. # @@ -36,11 +36,15 @@ AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/stat.h> -]], [[struct stat st; - if (!stat ("conftest.tmp/", &st)) return 1; +]], [[int result = 0; + struct stat st; + if (!stat ("conftest.tmp/", &st)) + result |= 1; #if HAVE_LSTAT - if (!stat ("conftest.lnk/", &st)) return 2; + if (!stat ("conftest.lnk/", &st)) + result |= 2; #endif + return result; ]])], [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no], [gl_cv_func_stat_file_slash="guessing no"])
--- a/m4/stdint.m4 +++ b/m4/stdint.m4 @@ -1,4 +1,4 @@ -# stdint.m4 serial 35 +# stdint.m4 serial 36 dnl Copyright (C) 2001-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -259,7 +259,7 @@ || strncmp (value, "((int)"/*)*/, 6) == 0 || strncmp (value, "((signed short)"/*)*/, 15) == 0 || strncmp (value, "((signed char)"/*)*/, 14) == 0) - return 1; + return mv - macro_values + 1; } return 0; ]])],
--- a/m4/stpncpy.m4 +++ b/m4/stpncpy.m4 @@ -1,4 +1,4 @@ -# stpncpy.m4 serial 12 +# stpncpy.m4 serial 13 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2010 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -37,19 +37,30 @@ #if !HAVE_DECL_STPNCPY extern char *stpncpy (char *dest, const char *src, size_t n); #endif -int main () { +int main () +{ + int result = 0; const char *src = "Hello"; char dest[10]; /* AIX 4.3.3 and AIX 5.1 stpncpy() returns dest+1 here. */ - strcpy (dest, "\377\377\377\377\377\377"); - if (stpncpy (dest, src, 2) != dest + 2) exit(1); + { + strcpy (dest, "\377\377\377\377\377\377"); + if (stpncpy (dest, src, 2) != dest + 2) + result |= 1; + } /* AIX 4.3.3 and AIX 5.1 stpncpy() returns dest+4 here. */ - strcpy (dest, "\377\377\377\377\377\377"); - if (stpncpy (dest, src, 5) != dest + 5) exit(1); + { + strcpy (dest, "\377\377\377\377\377\377"); + if (stpncpy (dest, src, 5) != dest + 5) + result |= 2; + } /* AIX 4.3.3 and AIX 5.1 stpncpy() returns dest+6 here. */ - strcpy (dest, "\377\377\377\377\377\377"); - if (stpncpy (dest, src, 7) != dest + 5) exit(1); - exit(0); + { + strcpy (dest, "\377\377\377\377\377\377"); + if (stpncpy (dest, src, 7) != dest + 5) + result |= 4; + } + return result; } ]])], [gl_cv_func_stpncpy=yes],
--- a/m4/strcasestr.m4 +++ b/m4/strcasestr.m4 @@ -1,4 +1,4 @@ -# strcasestr.m4 serial 17 +# strcasestr.m4 serial 18 dnl Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -80,10 +80,11 @@ #include <stdlib.h> /* for malloc */ #include <unistd.h> /* for alarm */ static void quit (int sig) { exit (sig + 128); } -]], [[size_t m = 1000000; +]], [[ + int result = 0; + 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 lack strcasestr. */ signal (SIGALRM, quit); @@ -97,9 +98,11 @@ memset (needle, 'A', m); needle[m] = 'B'; needle[m + 1] = 0; - result = strcasestr (haystack, needle); + if (!strcasestr (haystack, needle)) + result |= 1; } - return !result;]])], + return result; + ]])], [gl_cv_func_strcasestr_linear=yes], [gl_cv_func_strcasestr_linear=no], [dnl Only glibc > 2.12 and cygwin > 1.7.7 are known to have a dnl strcasestr that works in linear time.
--- a/m4/strerror_r.m4 +++ b/m4/strerror_r.m4 @@ -1,4 +1,4 @@ -# strerror_r.m4 serial 2 +# strerror_r.m4 serial 3 dnl Copyright (C) 2002, 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -49,9 +49,13 @@ #include <string.h> int strerror_r (int, char *, size_t); ]], - [[char buf[79]; - return strerror_r (EACCES, buf, 0) < 0 - || strerror_r (EACCES, buf, sizeof (buf)) != 0; + [[int result = 0; + char buf[79]; + if (strerror_r (EACCES, buf, 0) < 0) + result |= 1; + if (strerror_r (EACCES, buf, sizeof (buf)) != 0) + result |= 2; + return result; ]])], [gl_cv_func_strerror_r_works=yes], [gl_cv_func_strerror_r_works=no],
--- a/m4/strsignal.m4 +++ b/m4/strsignal.m4 @@ -1,4 +1,4 @@ -# strsignal.m4 serial 4 +# strsignal.m4 serial 5 dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -28,8 +28,14 @@ [[#include <string.h> #include <unistd.h> /* NetBSD 5.0 declares it in wrong header. */ ]], - [[char *s = strsignal (-1); - return !(s != (char *) 0 && s != (char *) -1);]])], + [[int result = 0; + char *s = strsignal (-1); + if (s == (char *) 0) + result |= 1; + if (s == (char *) -1) + result |= 2; + return result; + ]])], [gl_cv_func_working_strsignal=yes], [gl_cv_func_working_strsignal=no], [case "$host_os" in
--- a/m4/strstr.m4 +++ b/m4/strstr.m4 @@ -1,4 +1,4 @@ -# strstr.m4 serial 11 +# strstr.m4 serial 12 dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -68,10 +68,11 @@ #include <stdlib.h> /* for malloc */ #include <unistd.h> /* for alarm */ static void quit (int sig) { exit (sig + 128); } -]], [[size_t m = 1000000; +]], [[ + int result = 0; + 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, quit); @@ -85,9 +86,11 @@ memset (needle, 'A', m); needle[m] = 'B'; needle[m + 1] = 0; - result = strstr (haystack, needle); + if (!strstr (haystack, needle)) + result |= 1; } - return !result;]])], + return result; + ]])], [gl_cv_func_strstr_linear=yes], [gl_cv_func_strstr_linear=no], [dnl Only glibc > 2.12 and cygwin > 1.7.7 are known to have a dnl bug-free strstr that works in linear time.
--- a/m4/strtod.m4 +++ b/m4/strtod.m4 @@ -1,4 +1,4 @@ -# strtod.m4 serial 18 +# strtod.m4 serial 19 dnl Copyright (C) 2002-2003, 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -30,6 +30,7 @@ return x == y; } ]], [[ + int result = 0; { /* In some old versions of Linux (2000 or before), strtod mis-parses strings with leading '+'. */ @@ -37,7 +38,7 @@ char *term; double value = strtod (string, &term); if (value != 69 || term != (string + 4)) - return 1; + result |= 1; } { /* Under Solaris 2.4, strtod returns the wrong value for the @@ -46,7 +47,7 @@ char *term; strtod (string, &term); if (term != string && *(term - 1) == 0) - return 2; + result |= 2; } { /* Older glibc and Cygwin mis-parse "-0x". */ @@ -55,7 +56,7 @@ double value = strtod (string, &term); double zero = 0.0; if (1.0 / value != -1.0 / zero || term != (string + 2)) - return 3; + result |= 4; } { /* Many platforms do not parse hex floats. */ @@ -63,7 +64,7 @@ char *term; double value = strtod (string, &term); if (value != 20.0 || term != (string + 6)) - return 4; + result |= 8; } { /* Many platforms do not parse infinities. HP-UX 11.31 parses inf, @@ -74,7 +75,7 @@ errno = 0; value = strtod (string, &term); if (value != HUGE_VAL || term != (string + 3) || errno) - return 5; + result |= 16; } { /* glibc 2.7 and cygwin 1.5.24 misparse "nan()". */ @@ -82,7 +83,7 @@ char *term; double value = strtod (string, &term); if (numeric_equal (value, value) || term != (string + 5)) - return 6; + result |= 32; } { /* darwin 10.6.1 misparses "nan(". */ @@ -90,8 +91,9 @@ char *term; double value = strtod (string, &term); if (numeric_equal (value, value) || term != (string + 3)) - return 7; + result |= 64; } + return result; ]])], [gl_cv_func_strtod_works=yes], [gl_cv_func_strtod_works=no],
--- a/m4/symlink.m4 +++ b/m4/symlink.m4 @@ -1,4 +1,4 @@ -# serial 3 +# serial 4 # See if we need to provide symlink replacement. dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. @@ -24,9 +24,16 @@ [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <unistd.h> -]], [[if (!symlink ("a", "conftest.link/")) return 1; - if (symlink ("conftest.f", "conftest.lnk2")) return 2; - if (!symlink ("a", "conftest.lnk2/")) return 3;]])], + ]], + [[int result = 0; + if (!symlink ("a", "conftest.link/")) + result |= 1; + if (symlink ("conftest.f", "conftest.lnk2")) + result |= 2; + else if (!symlink ("a", "conftest.lnk2/")) + result |= 4; + return result; + ]])], [gl_cv_func_symlink_works=yes], [gl_cv_func_symlink_works=no], [gl_cv_func_symlink_works="guessing no"]) rm -f conftest.f conftest.link conftest.lnk2])
--- a/m4/tsearch.m4 +++ b/m4/tsearch.m4 @@ -1,4 +1,4 @@ -# tsearch.m4 serial 4 +# tsearch.m4 serial 5 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -25,13 +25,17 @@ int main () { + int result = 0; int x = 0; void *root = NULL; - if (!(tfind (&x, &root, cmp_fn) == NULL)) return 1; + if (!(tfind (&x, &root, cmp_fn) == NULL)) + result |= 1; tsearch (&x, &root, cmp_fn); - if (!(tfind (&x, &root, cmp_fn) != NULL)) return 1; - if (!(tdelete (&x, &root, cmp_fn) != NULL)) return 1; - return 0; + if (!(tfind (&x, &root, cmp_fn) != NULL)) + result |= 2; + if (!(tdelete (&x, &root, cmp_fn) != NULL)) + result |= 4; + return result; }]])], [gl_cv_func_tdelete_works=yes], [gl_cv_func_tdelete_works=no], [case "$host_os" in openbsd*) gl_cv_func_tdelete_works="guessing no";;
--- a/m4/ttyname_r.m4 +++ b/m4/ttyname_r.m4 @@ -1,4 +1,4 @@ -# ttyname_r.m4 serial 4 +# ttyname_r.m4 serial 5 dnl Copyright (C) 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -58,15 +58,16 @@ int main (void) { + int result = 0; int fd; char buf[31]; /* use any size < 128 here */ fd = open ("/dev/tty", O_RDONLY); if (fd < 0) - return 1; - if (ttyname_r (fd, buf, sizeof (buf)) != 0) - return 1; - return 0; + result |= 1; + else if (ttyname_r (fd, buf, sizeof (buf)) != 0) + result |= 2; + return result; }]])], [gl_cv_func_ttyname_r_works=yes], [:],
--- a/m4/unlink-busy.m4 +++ b/m4/unlink-busy.m4 @@ -1,4 +1,4 @@ -#serial 11 +#serial 12 dnl From J. David Anglin. @@ -20,7 +20,12 @@ int main (int argc, char **argv) { - return !argc || unlink (argv[0]) != 0; + int result = 0; + if (argc == 0) + result |= 1; + else if (unlink (argv[0]) != 0) + result |= 2; + return result; }]])], gl_cv_func_unlink_busy_text=yes, gl_cv_func_unlink_busy_text=no,
--- a/m4/unlink.m4 +++ b/m4/unlink.m4 @@ -1,4 +1,4 @@ -# unlink.m4 serial 5 +# unlink.m4 serial 6 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -21,11 +21,20 @@ [AC_LANG_PROGRAM( [[#include <unistd.h> #include <errno.h> -]], [[if (!unlink ("conftest.file/") || errno != ENOTDIR) return 1; + ]], + [[int result = 0; + if (!unlink ("conftest.file/")) + result |= 1; + else if (errno != ENOTDIR) + result |= 2; #if HAVE_LSTAT - if (!unlink ("conftest.lnk/") || errno != ENOTDIR) return 2; + if (!unlink ("conftest.lnk/")) + result |= 4; + else if (errno != ENOTDIR) + result |= 8; #endif - ]])], + return result; + ]])], [gl_cv_func_unlink_honors_slashes=yes], [gl_cv_func_unlink_honors_slashes=no], [gl_cv_func_unlink_honors_slashes="guessing no"]) @@ -65,9 +74,12 @@ #include <unistd.h> int main () { + int result = 0; if (chdir (getenv ("GL_SUBDIR_FOR_UNLINK")) != 0) - return 1; - return unlink ("..") == 0; + result |= 1; + else if (unlink ("..") == 0) + result |= 2; + return result; } ]])], [gl_cv_func_unlink_parent_fails=yes],
--- a/m4/utimensat.m4 +++ b/m4/utimensat.m4 @@ -1,4 +1,4 @@ -# serial 3 +# serial 4 # See if we need to provide utimensat replacement. dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. @@ -19,22 +19,39 @@ else AC_CACHE_CHECK([whether utimensat works], [gl_cv_func_utimensat_works], - [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ #include <fcntl.h> #include <sys/stat.h> #include <unistd.h> -]], [[struct timespec ts[2] = { { 1, UTIME_OMIT }, { 1, UTIME_NOW } }; - struct stat st; - const char *f = "conftest.file"; - if (close (creat (f, 0600))) return 1; - if (utimensat (AT_FDCWD, f, NULL, AT_SYMLINK_NOFOLLOW)) return 2; - if (utimensat (AT_FDCWD, f, ts, 0)) return 3; - sleep (1); - ts[0].tv_nsec = UTIME_NOW; - ts[1].tv_nsec = UTIME_OMIT; - if (utimensat (AT_FDCWD, f, ts, 0)) return 4; - if (stat (f, &st)) return 5; - if (st.st_ctime < st.st_atime) return 6;]])], +]], [[int result = 0; + const char *f = "conftest.file"; + if (close (creat (f, 0600))) + return 1; + /* Test whether the AT_SYMLINK_NOFOLLOW flag is supported. */ + { + if (utimensat (AT_FDCWD, f, NULL, AT_SYMLINK_NOFOLLOW)) + result |= 2; + } + /* Test whether UTIME_NOW and UTIME_OMIT work. */ + { + struct timespec ts[2] = { { 1, UTIME_OMIT }, { 1, UTIME_NOW } }; + if (utimensat (AT_FDCWD, f, ts, 0)) + result |= 4; + } + sleep (1); + { + struct timespec ts[2] = { { 1, UTIME_NOW }, { 1, UTIME_OMIT } }; + struct stat st; + if (utimensat (AT_FDCWD, f, ts, 0)) + result |= 8; + if (stat (f, &st)) + result |= 16; + else if (st.st_ctime < st.st_atime) + result |= 32; + } + return result; + ]])], dnl FIXME: simplify this in 2012, when file system bugs are no longer common [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #ifdef __linux__
--- a/m4/utimes.m4 +++ b/m4/utimes.m4 @@ -1,5 +1,5 @@ # Detect some bugs in glibc's implementation of utimes. -# serial 2 +# serial 3 dnl Copyright (C) 2003-2005, 2009-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -37,41 +37,71 @@ int main () { - static struct timeval timeval[2] = {{9, 10}, {999999, 999999}}; - struct stat sbuf; + int result = 0; char const *file = "conftest.utimes"; - FILE *f; - time_t now; - int fd; - int ok = ((f = fopen (file, "w")) - && fclose (f) == 0 - && utimes (file, timeval) == 0 - && lstat (file, &sbuf) == 0 - && sbuf.st_atime == timeval[0].tv_sec - && sbuf.st_mtime == timeval[1].tv_sec); - unlink (file); - if (!ok) - exit (1); + /* Test whether utimes() essentially works. */ + { + static struct timeval timeval[2] = {{9, 10}, {999999, 999999}}; + struct stat sbuf; + FILE *f = fopen (file, "w"); + if (f == NULL) + result |= 1; + else if (fclose (f) != 0) + result |= 1; + else if (utimes (file, timeval) != 0) + result |= 2; + else if (lstat (file, &sbuf) != 0) + result |= 1; + else if (!(sbuf.st_atime == timeval[0].tv_sec + && sbuf.st_mtime == timeval[1].tv_sec)) + result |= 4; + unlink (file); + } - ok = - ((f = fopen (file, "w")) - && fclose (f) == 0 - && time (&now) != (time_t)-1 - && utimes (file, NULL) == 0 - && lstat (file, &sbuf) == 0 - && now - sbuf.st_atime <= 2 - && now - sbuf.st_mtime <= 2); - unlink (file); - if (!ok) - exit (1); + /* Test whether utimes() with a NULL argument sets the file's timestamp + to the current time. Note that this test fails on NFS file systems + if there is a time skew between the host and the NFS server. */ + { + struct stat sbuf; + FILE *f = fopen (file, "w"); + if (f == NULL) + result |= 1; + else if (fclose (f) != 0) + result |= 1; + else + { + time_t now; + if (time (&now) == (time_t)-1) + result |= 1; + else if (utimes (file, NULL) != 0) + result |= 8; + else if (lstat (file, &sbuf) != 0) + result |= 1; + else + { + if (!(now - sbuf.st_atime <= 2)) + result |= 16; + if (!(now - sbuf.st_mtime <= 2)) + result |= 32; + } + } + unlink (file); + } - ok = (0 <= (fd = open (file, O_WRONLY|O_CREAT, 0444)) - && close (fd) == 0 - && utimes (file, NULL) == 0); - unlink (file); + /* Test whether utimes() with a NULL argument works on read-only files. */ + { + int fd = open (file, O_WRONLY|O_CREAT, 0444); + if (fd < 0) + result |= 1; + else if (close (fd) != 0) + result |= 1; + else if (utimes (file, NULL) != 0) + result |= 64; + unlink (file); + } - exit (!ok); + return result; } ]])], [gl_cv_func_working_utimes=yes],
--- a/m4/wcrtomb.m4 +++ b/m4/wcrtomb.m4 @@ -1,4 +1,4 @@ -# wcrtomb.m4 serial 6 +# wcrtomb.m4 serial 7 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -48,27 +48,28 @@ #include <wchar.h> int main () { + int result = 0; if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) - return 1; + result |= 1; } if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) - return 1; + result |= 2; } if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) - return 1; + result |= 4; } if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) - return 1; + result |= 8; } - return 0; + return result; }]])], [gl_cv_func_wcrtomb_retval=yes], [gl_cv_func_wcrtomb_retval=no],
--- a/m4/wcwidth.m4 +++ b/m4/wcwidth.m4 @@ -1,4 +1,4 @@ -# wcwidth.m4 serial 17 +# wcwidth.m4 serial 18 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -63,10 +63,15 @@ #endif int main () { + int result = 0; if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL) - if (wcwidth (0x0301) > 0 || wcwidth (0x200B) > 0) - return 1; - return 0; + { + if (wcwidth (0x0301) > 0) + result |= 1; + if (wcwidth (0x200B) > 0) + result |= 2; + } + return result; }]])], [gl_cv_func_wcwidth_works=yes], [gl_cv_func_wcwidth_works=no],