diff options
author | Simon Josefsson <simon@josefsson.org> | 2011-09-21 15:49:06 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2011-09-21 15:49:06 +0200 |
commit | 5fdaefe2cfd2e38a83fee58c6a2b852d5e124d69 (patch) | |
tree | aba3494f385bea407fd4b4f840b8b9cdfef711c2 /gl/m4 | |
parent | 0f206a54a53abe0ca38216081d587cf98096fb26 (diff) | |
download | gnutls-5fdaefe2cfd2e38a83fee58c6a2b852d5e124d69.tar.gz |
Update gnulib files.
Diffstat (limited to 'gl/m4')
35 files changed, 493 insertions, 85 deletions
diff --git a/gl/m4/argp.m4 b/gl/m4/argp.m4 index 4e3940a65c..a9963ee6d6 100644 --- a/gl/m4/argp.m4 +++ b/gl/m4/argp.m4 @@ -1,4 +1,4 @@ -# argp.m4 serial 12 +# argp.m4 serial 13 dnl Copyright (C) 2003-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -15,13 +15,13 @@ AC_DEFUN([gl_ARGP], [Define if program_invocation_name is declared])], [AC_DEFINE([GNULIB_PROGRAM_INVOCATION_NAME], [1], [Define to 1 to add extern declaration of program_invocation_name to argp.h])], - [#include <errno.h>]) + [[#include <errno.h>]]) AC_CHECK_DECL([program_invocation_short_name], [AC_DEFINE([HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME], [1], [Define if program_invocation_short_name is declared])], [AC_DEFINE([GNULIB_PROGRAM_INVOCATION_SHORT_NAME], [1], [Define to 1 to add extern declaration of program_invocation_short_name to argp.h])], - [#include <errno.h>]) + [[#include <errno.h>]]) # Check if program_invocation_name and program_invocation_short_name # are defined elsewhere. It is improbable that only one of them will diff --git a/gl/m4/closedir.m4 b/gl/m4/closedir.m4 new file mode 100644 index 0000000000..1b7912a30b --- /dev/null +++ b/gl/m4/closedir.m4 @@ -0,0 +1,23 @@ +# closedir.m4 serial 1 +dnl Copyright (C) 2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_CLOSEDIR], +[ + AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) + + AC_CHECK_FUNCS([closedir]) + if test $ac_cv_func_closedir = no; then + HAVE_CLOSEDIR=0 + fi + dnl Replace closedir() for supporting the gnulib-defined fchdir() function, + dnl to keep fchdir's bookkeeping up-to-date. + m4_ifdef([gl_FUNC_FCHDIR], [ + gl_TEST_FCHDIR + if test $HAVE_FCHDIR = 0; then + REPLACE_CLOSEDIR=1 + fi + ]) +]) diff --git a/gl/m4/dirent_h.m4 b/gl/m4/dirent_h.m4 index fdc2c440d6..ab45170b99 100644 --- a/gl/m4/dirent_h.m4 +++ b/gl/m4/dirent_h.m4 @@ -1,4 +1,4 @@ -# dirent_h.m4 serial 14 +# dirent_h.m4 serial 16 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -14,11 +14,17 @@ AC_DEFUN([gl_DIRENT_H], dnl <dirent.h> is always overridden, because of GNULIB_POSIXCHECK. gl_CHECK_NEXT_HEADERS([dirent.h]) + if test $ac_cv_header_dirent_h = yes; then + HAVE_DIRENT_H=1 + else + HAVE_DIRENT_H=0 + fi + AC_SUBST([HAVE_DIRENT_H]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <dirent.h> - ]], [alphasort dirfd fdopendir scandir]) + ]], [alphasort closedir dirfd fdopendir opendir readdir rewinddir scandir]) ]) AC_DEFUN([gl_DIRENT_MODULE_INDICATOR], @@ -33,18 +39,26 @@ AC_DEFUN([gl_DIRENT_MODULE_INDICATOR], AC_DEFUN([gl_DIRENT_H_DEFAULTS], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR + GNULIB_OPENDIR=0; AC_SUBST([GNULIB_OPENDIR]) + GNULIB_READDIR=0; AC_SUBST([GNULIB_READDIR]) + GNULIB_REWINDDIR=0; AC_SUBST([GNULIB_REWINDDIR]) + GNULIB_CLOSEDIR=0; AC_SUBST([GNULIB_CLOSEDIR]) GNULIB_DIRFD=0; AC_SUBST([GNULIB_DIRFD]) GNULIB_FDOPENDIR=0; AC_SUBST([GNULIB_FDOPENDIR]) GNULIB_SCANDIR=0; AC_SUBST([GNULIB_SCANDIR]) GNULIB_ALPHASORT=0; AC_SUBST([GNULIB_ALPHASORT]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_OPENDIR=1; AC_SUBST([HAVE_OPENDIR]) + HAVE_READDIR=1; AC_SUBST([HAVE_READDIR]) + HAVE_REWINDDIR=1; AC_SUBST([HAVE_REWINDDIR]) + HAVE_CLOSEDIR=1; AC_SUBST([HAVE_CLOSEDIR]) HAVE_DECL_DIRFD=1; AC_SUBST([HAVE_DECL_DIRFD]) HAVE_DECL_FDOPENDIR=1;AC_SUBST([HAVE_DECL_FDOPENDIR]) HAVE_FDOPENDIR=1; AC_SUBST([HAVE_FDOPENDIR]) HAVE_SCANDIR=1; AC_SUBST([HAVE_SCANDIR]) HAVE_ALPHASORT=1; AC_SUBST([HAVE_ALPHASORT]) + REPLACE_OPENDIR=0; AC_SUBST([REPLACE_OPENDIR]) REPLACE_CLOSEDIR=0; AC_SUBST([REPLACE_CLOSEDIR]) REPLACE_DIRFD=0; AC_SUBST([REPLACE_DIRFD]) REPLACE_FDOPENDIR=0; AC_SUBST([REPLACE_FDOPENDIR]) - REPLACE_OPENDIR=0; AC_SUBST([REPLACE_OPENDIR]) ]) diff --git a/gl/m4/environ.m4 b/gl/m4/environ.m4 index 7457ad1399..6c7982f9bb 100644 --- a/gl/m4/environ.m4 +++ b/gl/m4/environ.m4 @@ -1,4 +1,4 @@ -# environ.m4 serial 5 +# environ.m4 serial 6 dnl Copyright (C) 2001-2004, 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,7 +9,16 @@ AC_DEFUN_ONCE([gl_ENVIRON], AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl Persuade glibc <unistd.h> to declare environ. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - gt_CHECK_VAR_DECL([#include <unistd.h>], environ) + + AC_CHECK_HEADERS_ONCE([unistd.h]) + gt_CHECK_VAR_DECL( + [#if HAVE_UNISTD_H + #include <unistd.h> + #endif + /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */ + #include <stdlib.h> + ], + [environ]) if test $gt_cv_var_environ_declaration != yes; then HAVE_DECL_ENVIRON=0 fi diff --git a/gl/m4/fcntl-o.m4 b/gl/m4/fcntl-o.m4 index 88db07ec73..bee6edc114 100644 --- a/gl/m4/fcntl-o.m4 +++ b/gl/m4/fcntl-o.m4 @@ -1,4 +1,4 @@ -# fcntl-o.m4 serial 3 +# fcntl-o.m4 serial 4 dnl Copyright (C) 2006, 2009-2011 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,12 +17,21 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], [AC_REQUIRE([AC_GNU_SOURCE])]) + + AC_CHECK_HEADERS_ONCE([unistd.h]) + AC_CHECK_FUNCS_ONCE([symlink]) AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/types.h> #include <sys/stat.h> - #include <unistd.h> + #if HAVE_UNISTD_H + # include <unistd.h> + #else /* on Windows with MSVC */ + # include <io.h> + # include <stdlib.h> + # defined sleep(n) _sleep ((n) * 1000) + #endif #include <fcntl.h> #ifndef O_NOATIME #define O_NOATIME 0 @@ -38,6 +47,7 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], ]], [[ int result = !constants; + #if HAVE_SYMLINK { static char const sym[] = "conftest.sym"; if (symlink (".", sym) != 0) @@ -53,6 +63,7 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], } unlink (sym); } + #endif { static char const file[] = "confdefs.h"; int fd = open (file, O_RDONLY | O_NOATIME); diff --git a/gl/m4/fcntl_h.m4 b/gl/m4/fcntl_h.m4 index c466da4df5..03a41e6709 100644 --- a/gl/m4/fcntl_h.m4 +++ b/gl/m4/fcntl_h.m4 @@ -1,4 +1,4 @@ -# serial 13 +# serial 15 # Configure fcntl.h. dnl Copyright (C) 2006-2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -13,6 +13,12 @@ AC_DEFUN([gl_FCNTL_H], AC_REQUIRE([gl_FCNTL_O_FLAGS]) gl_NEXT_HEADERS([fcntl.h]) + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + + dnl Ensure the type mode_t gets defined. + AC_REQUIRE([AC_TYPE_MODE_T]) + dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, if it is not common dnl enough to be declared everywhere. diff --git a/gl/m4/frexp.m4 b/gl/m4/frexp.m4 index 125edcdc45..f2048f3be3 100644 --- a/gl/m4/frexp.m4 +++ b/gl/m4/frexp.m4 @@ -1,4 +1,4 @@ -# frexp.m4 serial 11 +# frexp.m4 serial 12 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -133,7 +133,7 @@ int main() result |= 1; } /* Test on infinite numbers. */ - x = 1.0 / 0.0; + x = 1.0 / zero; { int exp; double y = frexp (x, &exp); diff --git a/gl/m4/frexpl.m4 b/gl/m4/frexpl.m4 index 5843fa2f52..e9f9964dc8 100644 --- a/gl/m4/frexpl.m4 +++ b/gl/m4/frexpl.m4 @@ -1,4 +1,4 @@ -# frexpl.m4 serial 16 +# frexpl.m4 serial 17 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,7 +9,7 @@ AC_DEFUN([gl_FUNC_FREXPL], AC_REQUIRE([gl_MATH_H_DEFAULTS]) dnl Check whether it's declared. dnl MacOS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>. - AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include <math.h>]) + AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [[#include <math.h>]]) FREXPL_LIBM= if test $HAVE_DECL_FREXPL = 1; then gl_CHECK_FREXPL_NO_LIBM @@ -58,7 +58,7 @@ AC_DEFUN([gl_FUNC_FREXPL_NO_LIBM], AC_REQUIRE([gl_MATH_H_DEFAULTS]) dnl Check whether it's declared. dnl MacOS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>. - AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include <math.h>]) + AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [[#include <math.h>]]) if test $HAVE_DECL_FREXPL = 1; then gl_CHECK_FREXPL_NO_LIBM if test $gl_cv_func_frexpl_no_libm = yes; then diff --git a/gl/m4/getcwd.m4 b/gl/m4/getcwd.m4 index d3bbe597b3..f828cf340b 100644 --- a/gl/m4/getcwd.m4 +++ b/gl/m4/getcwd.m4 @@ -6,15 +6,20 @@ # with or without modifications, as long as this notice is preserved. # Written by Paul Eggert. -# serial 8 +# serial 9 AC_DEFUN([gl_FUNC_GETCWD_NULL], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result], [gl_cv_func_getcwd_null], [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ -# include <unistd.h> +# if HAVE_UNISTD_H +# include <unistd.h> +# else /* on Windows with MSVC */ +# include <direct.h> +# endif # ifndef getcwd char *getcwd (); # endif diff --git a/gl/m4/getpass.m4 b/gl/m4/getpass.m4 index 64cee1ea87..13e55f6832 100644 --- a/gl/m4/getpass.m4 +++ b/gl/m4/getpass.m4 @@ -1,4 +1,4 @@ -# getpass.m4 serial 13 +# getpass.m4 serial 14 dnl Copyright (C) 2002-2003, 2005-2006, 2009-2011 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -45,10 +45,10 @@ AC_DEFUN([gl_PREREQ_GETPASS], [ AC_CHECK_HEADERS_ONCE([stdio_ext.h termios.h]) AC_CHECK_FUNCS_ONCE([__fsetlocking tcgetattr tcsetattr]) AC_CHECK_DECLS([__fsetlocking],,, - [#include <stdio.h> - #if HAVE_STDIO_EXT_H - #include <stdio_ext.h> - #endif]) + [[#include <stdio.h> + #if HAVE_STDIO_EXT_H + #include <stdio_ext.h> + #endif]]) AC_CHECK_DECLS_ONCE([fflush_unlocked]) AC_CHECK_DECLS_ONCE([flockfile]) AC_CHECK_DECLS_ONCE([fputs_unlocked]) diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 6a67b59fd7..0660eb76b4 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -40,6 +40,7 @@ AC_DEFUN([gl_EARLY], # Code from module c-ctype: # Code from module c-ctype-tests: # Code from module clock-time: + # Code from module closedir: # Code from module crypto/hmac-md5: # Code from module crypto/hmac-md5-tests: # Code from module crypto/md5: @@ -61,6 +62,9 @@ AC_DEFUN([gl_EARLY], # Code from module fcntl-h: # Code from module fcntl-h-tests: # Code from module fd-hook: + # Code from module fdopen-tests: + # Code from module fgetc-tests: + # Code from module filename: # Code from module float: # Code from module float-tests: # Code from module fpieee: @@ -77,6 +81,7 @@ AC_DEFUN([gl_EARLY], # Code from module fseeko-tests: # Code from module fseterr: # Code from module fseterr-tests: + # Code from module fstat-tests: # Code from module ftell: # Code from module ftell-tests: # Code from module ftello: @@ -139,6 +144,7 @@ AC_DEFUN([gl_EARLY], # Code from module mempcpy: # Code from module memxor: # Code from module minmax: + # Code from module msvc-inval: # Code from module multiarch: # Code from module netdb: # Code from module netdb-tests: @@ -147,6 +153,9 @@ AC_DEFUN([gl_EARLY], # Code from module nocrash: # Code from module open: # Code from module open-tests: + # Code from module opendir: + # Code from module pathmax: + # Code from module pathmax-tests: # Code from module printf-frexp: # Code from module printf-frexp-tests: # Code from module printf-frexpl: @@ -158,6 +167,7 @@ AC_DEFUN([gl_EARLY], # Code from module rawmemchr-tests: # Code from module read-file: # Code from module read-file-tests: + # Code from module readdir: # Code from module realloc-posix: # Code from module same-inode: # Code from module scandir: @@ -178,6 +188,7 @@ AC_DEFUN([gl_EARLY], # Code from module sockets: # Code from module sockets-tests: # Code from module socklen: + # Code from module ssize_t: # Code from module stat: # Code from module stat-tests: # Code from module stdarg: @@ -220,6 +231,8 @@ AC_DEFUN([gl_EARLY], # Code from module sys_stat-tests: # Code from module sys_time: # Code from module sys_time-tests: + # Code from module sys_types: + # Code from module sys_types-tests: # Code from module sys_uio: # Code from module sys_uio-tests: # Code from module sysexits: @@ -290,6 +303,11 @@ m4_ifdef([AM_XGETTEXT_OPTION], AM_][XGETTEXT_OPTION([--flag=argp_failure:4:c-format])]) gl_BYTESWAP gl_CLOCK_TIME +gl_FUNC_CLOSEDIR +if test $HAVE_CLOSEDIR = 0 || test $REPLACE_CLOSEDIR = 1; then + AC_LIBOBJ([closedir]) +fi +gl_DIRENT_MODULE_INDICATOR([closedir]) gl_MD5 gl_DIRENT_H gl_DIRNAME_LGPL @@ -453,6 +471,11 @@ gl_MULTIARCH gl_HEADER_NETDB gl_HEADER_NETINET_IN AC_PROG_MKDIR_P +gl_FUNC_OPENDIR +if test $HAVE_OPENDIR = 0 || test $REPLACE_OPENDIR = 1; then + AC_LIBOBJ([opendir]) +fi +gl_DIRENT_MODULE_INDICATOR([opendir]) gl_FUNC_PRINTF_FREXP gl_FUNC_PRINTF_FREXPL m4_divert_text([INIT_PREPARE], [gl_printf_safe=yes]) @@ -465,6 +488,11 @@ if test $HAVE_RAWMEMCHR = 0; then fi gl_STRING_MODULE_INDICATOR([rawmemchr]) gl_PREREQ_READ_FILE +gl_FUNC_READDIR +if test $HAVE_READDIR = 0; then + AC_LIBOBJ([readdir]) +fi +gl_DIRENT_MODULE_INDICATOR([readdir]) gl_FUNC_REALLOC_POSIX if test $REPLACE_REALLOC = 1; then AC_LIBOBJ([realloc]) @@ -495,6 +523,7 @@ gl_MODULE_INDICATOR([snprintf]) gl_SOCKETLIB gl_SOCKETS gl_TYPE_SOCKLEN_T +gt_TYPE_SSIZE_T gl_STDARG_H AM_STDBOOL_H gl_STDDEF_H @@ -559,6 +588,8 @@ gl_HEADER_SYS_STAT_H AC_PROG_MKDIR_P gl_HEADER_SYS_TIME_H AC_PROG_MKDIR_P +gl_SYS_TYPES_H +AC_PROG_MKDIR_P gl_HEADER_SYS_UIO AC_PROG_MKDIR_P gl_SYSEXITS @@ -674,12 +705,17 @@ dnl Check for prerequisites for memory fence checks. gl_FUNC_MMAP_ANON AC_CHECK_HEADERS_ONCE([sys/mman.h]) AC_CHECK_FUNCS_ONCE([mprotect]) +gl_MSVC_INVAL +if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + AC_LIBOBJ([msvc-inval]) +fi gl_FUNC_OPEN if test $REPLACE_OPEN = 1; then AC_LIBOBJ([open]) gl_PREREQ_OPEN fi gl_FCNTL_MODULE_INDICATOR([open]) +gl_PATHMAX gl_FUNC_PUTENV if test $REPLACE_PUTENV = 1; then AC_LIBOBJ([putenv]) @@ -847,6 +883,8 @@ AC_DEFUN([gl_FILE_LIST], [ lib/byteswap.in.h lib/c-ctype.c lib/c-ctype.h + lib/closedir.c + lib/dirent-private.h lib/dirent.in.h lib/dirname-lgpl.c lib/dirname.h @@ -856,6 +894,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/error.h lib/fd-hook.c lib/fd-hook.h + lib/filename.h lib/float+.h lib/float.c lib/float.in.h @@ -904,6 +943,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/minmax.h lib/netdb.in.h lib/netinet_in.in.h + lib/opendir.c lib/printf-args.c lib/printf-args.h lib/printf-frexp.c @@ -918,6 +958,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/rawmemchr.valgrind lib/read-file.c lib/read-file.h + lib/readdir.c lib/realloc.c lib/scandir.c lib/signbitd.c @@ -953,6 +994,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/sys_socket.in.h lib/sys_stat.in.h lib/sys_time.in.h + lib/sys_types.in.h lib/sys_uio.in.h lib/sysexits.in.h lib/time.in.h @@ -979,6 +1021,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/argp.m4 m4/byteswap.m4 m4/clock_time.m4 + m4/closedir.m4 m4/codeset.m4 m4/dirent_h.m4 m4/dirname.m4 @@ -1054,12 +1097,15 @@ AC_DEFUN([gl_FILE_LIST], [ m4/minmax.m4 m4/mmap-anon.m4 m4/mode_t.m4 + m4/msvc-inval.m4 m4/multiarch.m4 m4/netdb_h.m4 m4/netinet_in_h.m4 m4/nls.m4 m4/nocrash.m4 m4/open.m4 + m4/opendir.m4 + m4/pathmax.m4 m4/po.m4 m4/printf-frexp.m4 m4/printf-frexpl.m4 @@ -1069,6 +1115,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/putenv.m4 m4/rawmemchr.m4 m4/read-file.m4 + m4/readdir.m4 m4/realloc.m4 m4/scandir.m4 m4/setenv.m4 @@ -1080,6 +1127,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/sockets.m4 m4/socklen.m4 m4/sockpfaf.m4 + m4/ssize_t.m4 m4/stat.m4 m4/stdarg.m4 m4/stdbool.m4 @@ -1101,6 +1149,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/sys_socket_h.m4 m4/sys_stat_h.m4 m4/sys_time_h.m4 + m4/sys_types_h.m4 m4/sys_uio_h.m4 m4/sysexits.m4 m4/threadlib.m4 @@ -1124,6 +1173,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/wchar_t.m4 m4/wint_t.m4 m4/xsize.m4 + tests/infinity.h tests/init.sh tests/macros.h tests/minus-zero.h @@ -1141,6 +1191,8 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-environ.c tests/test-errno.c tests/test-fcntl-h.c + tests/test-fdopen.c + tests/test-fgetc.c tests/test-float.c tests/test-fprintf-posix.h tests/test-frexp.c @@ -1153,7 +1205,10 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-fseeko2.sh tests/test-fseeko3.c tests/test-fseeko3.sh + tests/test-fseeko4.c + tests/test-fseeko4.sh tests/test-fseterr.c + tests/test-fstat.c tests/test-ftell.c tests/test-ftell.sh tests/test-ftell2.sh @@ -1162,6 +1217,8 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-ftello.sh tests/test-ftello2.sh tests/test-ftello3.c + tests/test-ftello4.c + tests/test-ftello4.sh tests/test-func.c tests/test-getcwd-lgpl.c tests/test-getdelim.c @@ -1191,6 +1248,7 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-netinet_in.c tests/test-open.c tests/test-open.h + tests/test-pathmax.c tests/test-printf-frexp.c tests/test-printf-frexpl.c tests/test-printf-posix.h @@ -1220,6 +1278,7 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-sys_socket.c tests/test-sys_stat.c tests/test-sys_time.c + tests/test-sys_types.c tests/test-sys_uio.c tests/test-sys_wait.h tests/test-sysexits.c @@ -1253,7 +1312,10 @@ AC_DEFUN([gl_FILE_LIST], [ tests=lib/malloca.c tests=lib/malloca.h tests=lib/malloca.valgrind + tests=lib/msvc-inval.c + tests=lib/msvc-inval.h tests=lib/open.c + tests=lib/pathmax.h tests=lib/putenv.c tests=lib/same-inode.h tests=lib/setenv.c diff --git a/gl/m4/iconv.m4 b/gl/m4/iconv.m4 index 085cd068f5..98fcd64d31 100644 --- a/gl/m4/iconv.m4 +++ b/gl/m4/iconv.m4 @@ -1,4 +1,4 @@ -# iconv.m4 serial 17 (gettext-0.18.2) +# iconv.m4 serial 18 (gettext-0.18.2) dnl Copyright (C) 2000-2002, 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -242,7 +242,7 @@ extern #ifdef __cplusplus "C" #endif -#if defined(__STDC__) || defined(__cplusplus) +#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); #else size_t iconv(); diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4 index ebf081a110..d5230ced8d 100644 --- a/gl/m4/include_next.m4 +++ b/gl/m4/include_next.m4 @@ -1,4 +1,4 @@ -# include_next.m4 serial 20 +# include_next.m4 serial 22 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -207,17 +207,36 @@ dnl until we can assume autoconf 2.64 or newer. aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac +changequote(,) + case "$host_os" in + mingw*) + dnl For the sake of native Windows compilers (excluding gcc), + dnl treat backslash as a directory separator, like /. + dnl Actually, these compilers use a double-backslash as + dnl directory separator, inside the + dnl # line "filename" + dnl directives. + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='/' + ;; + esac +changequote([,]) + gl_absolute_header_sed='\|'"${gl_dirsep_regex}"']m4_defn([gl_HEADER_NAME])[|{ + s|.*"\(.*'"${gl_dirsep_regex}"']m4_defn([gl_HEADER_NAME])[\)".*|\1| +changequote(,)dnl + s|^/[^/]|//&| +changequote([,])dnl + p + q + }' dnl eval is necessary to expand gl_absname_cpp. dnl Ultrix and Pyramid sh refuse to redirect output of eval, dnl so use subshell. AS_VAR_SET(gl_next_header, ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | - sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{ - s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"']) + sed -n "$gl_absolute_header_sed"`'"']) m4_if([$2], [check], [else AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>']) diff --git a/gl/m4/ldexpl.m4 b/gl/m4/ldexpl.m4 index 76101f3360..4e419cf205 100644 --- a/gl/m4/ldexpl.m4 +++ b/gl/m4/ldexpl.m4 @@ -1,4 +1,4 @@ -# ldexpl.m4 serial 12 +# ldexpl.m4 serial 13 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,7 +10,7 @@ AC_DEFUN([gl_FUNC_LDEXPL], AC_REQUIRE([gl_FUNC_ISNANL]) dnl for ISNANL_LIBM dnl Check whether it's declared. dnl MacOS X 10.3 has ldexpl() in libc but doesn't declare it in <math.h>. - AC_CHECK_DECL([ldexpl], , [HAVE_DECL_LDEXPL=0], [#include <math.h>]) + AC_CHECK_DECL([ldexpl], , [HAVE_DECL_LDEXPL=0], [[#include <math.h>]]) LDEXPL_LIBM= if test $HAVE_DECL_LDEXPL = 1; then gl_CHECK_LDEXPL_NO_LIBM diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4 index b45488445d..73c40698c2 100644 --- a/gl/m4/lseek.m4 +++ b/gl/m4/lseek.m4 @@ -1,4 +1,4 @@ -# lseek.m4 serial 7 +# lseek.m4 serial 8 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,12 +8,18 @@ AC_DEFUN([gl_FUNC_LSEEK], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([AC_PROG_CC]) + AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe], [if test $cross_compiling = no; then AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> /* for off_t */ #include <stdio.h> /* for SEEK_CUR */ -#include <unistd.h>]], [[ +#if HAVE_UNISTD_H +# include <unistd.h> +#else /* on Windows with MSVC */ +# include <io.h> +#endif +]], [[ /* Exit with success only if stdin is seekable. */ return lseek (0, (off_t)0, SEEK_CUR) < 0; ]])], diff --git a/gl/m4/msvc-inval.m4 b/gl/m4/msvc-inval.m4 new file mode 100644 index 0000000000..fb797f0556 --- /dev/null +++ b/gl/m4/msvc-inval.m4 @@ -0,0 +1,19 @@ +# msvc-inval.m4 serial 1 +dnl Copyright (C) 2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_MSVC_INVAL], +[ + AC_CHECK_FUNCS_ONCE([_set_invalid_parameter_handler]) + if test $ac_cv_func__set_invalid_parameter_handler = yes; then + HAVE_MSVC_INVALID_PARAMETER_HANDLER=1 + AC_DEFINE([HAVE_MSVC_INVALID_PARAMETER_HANDLER], [1], + [Define to 1 on MSVC platforms that have the "invalid parameter handler" + concept.]) + else + HAVE_MSVC_INVALID_PARAMETER_HANDLER=0 + fi + AC_SUBST([HAVE_MSVC_INVALID_PARAMETER_HANDLER]) +]) diff --git a/gl/m4/nocrash.m4 b/gl/m4/nocrash.m4 index 0cc0d53ebf..60aad95295 100644 --- a/gl/m4/nocrash.m4 +++ b/gl/m4/nocrash.m4 @@ -1,4 +1,4 @@ -# nocrash.m4 serial 2 +# nocrash.m4 serial 3 dnl Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -79,6 +79,34 @@ nocrash_init (void) } } } +#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +/* Avoid a crash on native Windows. */ +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <winerror.h> +static LONG WINAPI +exception_filter (EXCEPTION_POINTERS *ExceptionInfo) +{ + switch (ExceptionInfo->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_IN_PAGE_ERROR: + case EXCEPTION_STACK_OVERFLOW: + case EXCEPTION_GUARD_PAGE: + case EXCEPTION_PRIV_INSTRUCTION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + exit (1); + } + return EXCEPTION_CONTINUE_SEARCH; +} +static void +nocrash_init (void) +{ + SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); +} #else /* Avoid a crash on POSIX systems. */ #include <signal.h> diff --git a/gl/m4/opendir.m4 b/gl/m4/opendir.m4 new file mode 100644 index 0000000000..fa315b9837 --- /dev/null +++ b/gl/m4/opendir.m4 @@ -0,0 +1,23 @@ +# opendir.m4 serial 1 +dnl Copyright (C) 2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_OPENDIR], +[ + AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) + + AC_CHECK_FUNCS([opendir]) + if test $ac_cv_func_opendir = no; then + HAVE_OPENDIR=0 + fi + dnl Replace opendir() for supporting the gnulib-defined fchdir() function, + dnl to keep fchdir's bookkeeping up-to-date. + m4_ifdef([gl_FUNC_FCHDIR], [ + gl_TEST_FCHDIR + if test $HAVE_FCHDIR = 0; then + REPLACE_OPENDIR=1 + fi + ]) +]) diff --git a/gl/m4/pathmax.m4 b/gl/m4/pathmax.m4 new file mode 100644 index 0000000000..0856722c39 --- /dev/null +++ b/gl/m4/pathmax.m4 @@ -0,0 +1,12 @@ +# pathmax.m4 serial 9 +dnl Copyright (C) 2002-2003, 2005-2006, 2009-2011 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_PATHMAX], +[ + dnl Prerequisites of lib/pathmax.h. + AC_CHECK_HEADERS_ONCE([sys/param.h]) +]) diff --git a/gl/m4/printf-frexpl.m4 b/gl/m4/printf-frexpl.m4 index 9c13d4e7f5..9b698c9be1 100644 --- a/gl/m4/printf-frexpl.m4 +++ b/gl/m4/printf-frexpl.m4 @@ -1,4 +1,4 @@ -# printf-frexpl.m4 serial 7 +# printf-frexpl.m4 serial 8 dnl Copyright (C) 2007, 2009-2011 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,7 +27,7 @@ AC_DEFUN([gl_FUNC_PRINTF_FREXPL], [Define if the frexpl function is available in libc.]) dnl Also check whether it's declared. dnl MacOS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>. - AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include <math.h>]) + AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [[#include <math.h>]]) fi gl_CHECK_LDEXPL_NO_LIBM @@ -39,7 +39,7 @@ AC_DEFUN([gl_FUNC_PRINTF_FREXPL], [Define if the ldexpl function is available in libc.]) dnl Also check whether it's declared. dnl MacOS X 10.3 has ldexpl() in libc but doesn't declare it in <math.h>. - AC_CHECK_DECL([ldexpl], , [HAVE_DECL_LDEXPL=0], [#include <math.h>]) + AC_CHECK_DECL([ldexpl], , [HAVE_DECL_LDEXPL=0], [[#include <math.h>]]) ;; esac fi diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4 index 1538d23fd4..d046c11123 100644 --- a/gl/m4/printf.m4 +++ b/gl/m4/printf.m4 @@ -1,4 +1,4 @@ -# printf.m4 serial 43 +# printf.m4 serial 45 dnl Copyright (C) 2003, 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -178,28 +178,28 @@ static double zero = 0.0; int main () { int result = 0; - if (sprintf (buf, "%f", 1.0 / 0.0) < 0 + if (sprintf (buf, "%f", 1.0 / zero) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) result |= 1; - if (sprintf (buf, "%f", -1.0 / 0.0) < 0 + if (sprintf (buf, "%f", -1.0 / zero) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) result |= 1; if (sprintf (buf, "%f", zero / zero) < 0 || !strisnan (buf, 0, strlen (buf))) result |= 2; - if (sprintf (buf, "%e", 1.0 / 0.0) < 0 + if (sprintf (buf, "%e", 1.0 / zero) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) result |= 4; - if (sprintf (buf, "%e", -1.0 / 0.0) < 0 + if (sprintf (buf, "%e", -1.0 / zero) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) result |= 4; if (sprintf (buf, "%e", zero / zero) < 0 || !strisnan (buf, 0, strlen (buf))) result |= 8; - if (sprintf (buf, "%g", 1.0 / 0.0) < 0 + if (sprintf (buf, "%g", 1.0 / zero) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) result |= 16; - if (sprintf (buf, "%g", -1.0 / 0.0) < 0 + if (sprintf (buf, "%g", -1.0 / zero) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) result |= 16; if (sprintf (buf, "%g", zero / zero) < 0 @@ -294,28 +294,28 @@ int main () { int result = 0; nocrash_init(); - if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0 + if (sprintf (buf, "%Lf", 1.0L / zeroL) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) result |= 1; - if (sprintf (buf, "%Lf", -1.0L / 0.0L) < 0 + if (sprintf (buf, "%Lf", -1.0L / zeroL) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) result |= 1; if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 || !strisnan (buf, 0, strlen (buf))) result |= 1; - if (sprintf (buf, "%Le", 1.0L / 0.0L) < 0 + if (sprintf (buf, "%Le", 1.0L / zeroL) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) result |= 1; - if (sprintf (buf, "%Le", -1.0L / 0.0L) < 0 + if (sprintf (buf, "%Le", -1.0L / zeroL) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) result |= 1; if (sprintf (buf, "%Le", zeroL / zeroL) < 0 || !strisnan (buf, 0, strlen (buf))) result |= 1; - if (sprintf (buf, "%Lg", 1.0L / 0.0L) < 0 + if (sprintf (buf, "%Lg", 1.0L / zeroL) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) result |= 1; - if (sprintf (buf, "%Lg", -1.0L / 0.0L) < 0 + if (sprintf (buf, "%Lg", -1.0L / zeroL) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) result |= 1; if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 @@ -478,6 +478,7 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_A], #include <stdio.h> #include <string.h> static char buf[100]; +static double zero = 0.0; int main () { int result = 0; @@ -502,7 +503,7 @@ int main () 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 + if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 || buf[0] == '0') result |= 8; /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug. */ @@ -562,13 +563,14 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_F], #include <stdio.h> #include <string.h> static char buf[100]; +static double zero = 0.0; int main () { int result = 0; if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 || strcmp (buf, "1234567.000000 33") != 0) result |= 1; - if (sprintf (buf, "%F", 1.0 / 0.0) < 0 + if (sprintf (buf, "%F", 1.0 / zero) < 0 || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) result |= 2; /* This catches a Cygwin 1.5.x bug. */ @@ -615,12 +617,27 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N], AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> +#include <stdlib.h> #include <string.h> +#ifdef _MSC_VER +/* See page about "Parameter Validation" on msdn.microsoft.com. */ +static void cdecl +invalid_parameter_handler (const wchar_t *expression, + const wchar_t *function, + const wchar_t *file, unsigned int line, + uintptr_t dummy) +{ + exit (1); +} +#endif static char fmtstring[10]; static char buf[100]; int main () { int count = -1; +#ifdef _MSC_VER + _set_invalid_parameter_handler (invalid_parameter_handler); +#endif /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) support %n in format strings in read-only memory but not in writable memory. */ @@ -636,7 +653,8 @@ int main () [ changequote(,)dnl case "$host_os" in - *) gl_cv_func_printf_directive_n="guessing yes";; + mingw*) gl_cv_func_printf_directive_n="guessing no";; + *) gl_cv_func_printf_directive_n="guessing yes";; esac changequote([,])dnl ]) @@ -862,9 +880,10 @@ AC_DEFUN([gl_PRINTF_FLAG_ZERO], #include <stdio.h> #include <string.h> static char buf[100]; +static double zero = 0.0; int main () { - if (sprintf (buf, "%010f", 1.0 / 0.0, 33, 44, 55) < 0 + if (sprintf (buf, "%010f", 1.0 / zero, 33, 44, 55) < 0 || (strcmp (buf, " inf") != 0 && strcmp (buf, " infinity") != 0)) return 1; @@ -1076,6 +1095,7 @@ AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_REQUIRE([gl_SNPRINTF_PRESENCE]) AC_CACHE_CHECK([whether snprintf truncates the result as in C99], [gl_cv_func_snprintf_truncation_c99], [ @@ -1083,11 +1103,25 @@ AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99], [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include <stdarg.h> +static int my_snprintf (char *buf, int size, const char *format, ...) +{ + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} +#endif static char buf[100]; int main () { strcpy (buf, "ABCDEF"); - snprintf (buf, 3, "%d %d", 4567, 89); + my_snprintf (buf, 3, "%d %d", 4567, 89); if (memcmp (buf, "45\0DEF", 6) != 0) return 1; return 0; @@ -1157,6 +1191,7 @@ AC_DEFUN_ONCE([gl_SNPRINTF_RETVAL_C99], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_REQUIRE([gl_SNPRINTF_PRESENCE]) AC_CACHE_CHECK([whether snprintf returns a byte count as in C99], [gl_cv_func_snprintf_retval_c99], [ @@ -1164,15 +1199,29 @@ AC_DEFUN_ONCE([gl_SNPRINTF_RETVAL_C99], [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include <stdarg.h> +static int my_snprintf (char *buf, int size, const char *format, ...) +{ + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} +#endif static char buf[100]; int main () { strcpy (buf, "ABCDEF"); - if (snprintf (buf, 3, "%d %d", 4567, 89) != 7) + if (my_snprintf (buf, 3, "%d %d", 4567, 89) != 7) return 1; - if (snprintf (buf, 0, "%d %d", 4567, 89) != 7) + if (my_snprintf (buf, 0, "%d %d", 4567, 89) != 7) return 2; - if (snprintf (NULL, 0, "%d %d", 4567, 89) != 7) + if (my_snprintf (NULL, 0, "%d %d", 4567, 89) != 7) return 3; return 0; }]])], @@ -1221,6 +1270,7 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_REQUIRE([gl_SNPRINTF_PRESENCE]) AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive], [gl_cv_func_snprintf_directive_n], [ @@ -1228,6 +1278,20 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include <stdarg.h> +static int my_snprintf (char *buf, int size, const char *format, ...) +{ + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} +#endif static char fmtstring[10]; static char buf[100]; int main () @@ -1237,7 +1301,7 @@ int main () support %n in format strings in read-only memory but not in writable memory. */ strcpy (fmtstring, "%d %n"); - snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55); + my_snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55); if (count != 6) return 1; return 0; @@ -1289,16 +1353,31 @@ dnl Result is gl_cv_func_snprintf_size1. AC_DEFUN([gl_SNPRINTF_SIZE1], [ AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([gl_SNPRINTF_PRESENCE]) AC_CACHE_CHECK([whether snprintf respects a size of 1], [gl_cv_func_snprintf_size1], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <stdio.h> +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include <stdarg.h> +static int my_snprintf (char *buf, int size, const char *format, ...) +{ + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} +#endif int main() { static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; - snprintf (buf, 1, "%d", 12345); + my_snprintf (buf, 1, "%d", 12345); return buf[1] != 'E'; }]])], [gl_cv_func_snprintf_size1=yes], @@ -1484,5 +1563,6 @@ dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . dnl Haiku . . . # # # . # . . . . . ? . . ? . . . dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . . dnl old mingw / msvcrt # # # # # # . . # # . # # ? . # # # . . +dnl MSVC 9 # # # # # # # . # # . # # ? # # # # . . dnl mingw 2009-2011 . # . # . . . . # # . . . ? . . . . . . dnl mingw-w64 2011 # # # # # # . . # # . # # ? . # # # . . diff --git a/gl/m4/readdir.m4 b/gl/m4/readdir.m4 new file mode 100644 index 0000000000..cfeed08907 --- /dev/null +++ b/gl/m4/readdir.m4 @@ -0,0 +1,15 @@ +# readdir.m4 serial 1 +dnl Copyright (C) 2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_READDIR], +[ + AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) + + AC_CHECK_FUNCS([readdir]) + if test $ac_cv_func_readdir = no; then + HAVE_READDIR=0 + fi +]) diff --git a/gl/m4/setenv.m4 b/gl/m4/setenv.m4 index 8927a6cac1..bc215a6d4d 100644 --- a/gl/m4/setenv.m4 +++ b/gl/m4/setenv.m4 @@ -1,4 +1,4 @@ -# setenv.m4 serial 24 +# setenv.m4 serial 25 dnl Copyright (C) 2001-2004, 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -77,11 +77,7 @@ extern #ifdef __cplusplus "C" #endif -#if defined(__STDC__) || defined(__cplusplus) int unsetenv (const char *name); -#else -int unsetenv(); -#endif ]], [[]])], [gt_cv_func_unsetenv_ret='int'], diff --git a/gl/m4/signbit.m4 b/gl/m4/signbit.m4 index 696a9b6e1d..bbeb1f48c0 100644 --- a/gl/m4/signbit.m4 +++ b/gl/m4/signbit.m4 @@ -1,4 +1,4 @@ -# signbit.m4 serial 10 +# signbit.m4 serial 11 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -65,7 +65,7 @@ AC_DEFUN([gl_SIGNBIT], gl_LONG_DOUBLE_SIGN_LOCATION if test "$gl_cv_cc_float_signbit" = unknown; then dnl Test whether copysignf() is declared. - AC_CHECK_DECLS([copysignf], , , [#include <math.h>]) + AC_CHECK_DECLS([copysignf], , , [[#include <math.h>]]) if test "$ac_cv_have_decl_copysignf" = yes; then dnl Test whether copysignf() can be used without libm. AC_CACHE_CHECK([whether copysignf can be used without linking with libm], @@ -87,7 +87,7 @@ AC_DEFUN([gl_SIGNBIT], fi if test "$gl_cv_cc_double_signbit" = unknown; then dnl Test whether copysign() is declared. - AC_CHECK_DECLS([copysign], , , [#include <math.h>]) + AC_CHECK_DECLS([copysign], , , [[#include <math.h>]]) if test "$ac_cv_have_decl_copysign" = yes; then dnl Test whether copysign() can be used without libm. AC_CACHE_CHECK([whether copysign can be used without linking with libm], @@ -109,7 +109,7 @@ AC_DEFUN([gl_SIGNBIT], fi if test "$gl_cv_cc_long_double_signbit" = unknown; then dnl Test whether copysignl() is declared. - AC_CHECK_DECLS([copysignl], , , [#include <math.h>]) + AC_CHECK_DECLS([copysignl], , , [[#include <math.h>]]) if test "$ac_cv_have_decl_copysignl" = yes; then dnl Test whether copysignl() can be used without libm. AC_CACHE_CHECK([whether copysignl can be used without linking with libm], diff --git a/gl/m4/sleep.m4 b/gl/m4/sleep.m4 index 37f19a9e4f..74362e49b5 100644 --- a/gl/m4/sleep.m4 +++ b/gl/m4/sleep.m4 @@ -1,4 +1,4 @@ -# sleep.m4 serial 5 +# sleep.m4 serial 6 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -12,7 +12,7 @@ AC_DEFUN([gl_FUNC_SLEEP], dnl _sleep() in MSVCRT. It has a different signature than POSIX sleep(): dnl it takes the number of milliseconds as argument and returns void. dnl mingw does not declare this function. - AC_CHECK_DECLS([sleep], , , [#include <unistd.h>]) + AC_CHECK_DECLS([sleep], , , [[#include <unistd.h>]]) AC_CHECK_FUNCS_ONCE([sleep]) if test $ac_cv_have_decl_sleep != yes; then HAVE_SLEEP=0 diff --git a/gl/m4/ssize_t.m4 b/gl/m4/ssize_t.m4 new file mode 100644 index 0000000000..d7127521eb --- /dev/null +++ b/gl/m4/ssize_t.m4 @@ -0,0 +1,23 @@ +# ssize_t.m4 serial 5 (gettext-0.18.2) +dnl Copyright (C) 2001-2003, 2006, 2010-2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. +dnl Test whether ssize_t is defined. + +AC_DEFUN([gt_TYPE_SSIZE_T], +[ + AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/types.h>]], + [[int x = sizeof (ssize_t *) + sizeof (ssize_t); + return !x;]])], + [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])]) + if test $gt_cv_ssize_t = no; then + AC_DEFINE([ssize_t], [int], + [Define as a signed type of the same size as size_t.]) + fi +]) diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4 index c75e95722a..092161c996 100644 --- a/gl/m4/stdint.m4 +++ b/gl/m4/stdint.m4 @@ -466,6 +466,14 @@ AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], fi gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t], [gl_STDINT_INCLUDES]) + + dnl If wint_t is smaller than 'int', it cannot satisfy the ISO C 99 + dnl requirement that wint_t is "unchanged by default argument promotions". + dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t. + dnl Set the variable BITSIZEOF_WINT_T accordingly. + if test $BITSIZEOF_WINT_T -lt 32; then + BITSIZEOF_WINT_T=32 + fi ]) dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4 index a8326f3c34..988e0255d8 100644 --- a/gl/m4/stdio_h.m4 +++ b/gl/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 37 +# stdio_h.m4 serial 39 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -74,7 +74,7 @@ AC_DEFUN([gl_STDIO_H], dnl corresponding gnulib module is not in use, and which is not dnl guaranteed by C89. gl_WARN_ON_USE_PREPARE([[#include <stdio.h> - ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat + ]], [dprintf fpurge fseeko ftello getdelim getline pclose popen renameat snprintf tmpfile vdprintf vsnprintf]) ]) @@ -115,6 +115,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], GNULIB_GETS=0; AC_SUBST([GNULIB_GETS]) GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) + GNULIB_PCLOSE=0; AC_SUBST([GNULIB_PCLOSE]) GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR]) GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN]) GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF]) @@ -153,6 +154,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO]) + HAVE_PCLOSE=1; AC_SUBST([HAVE_PCLOSE]) + HAVE_POPEN=1; AC_SUBST([HAVE_POPEN]) HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT]) HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF]) diff --git a/gl/m4/strings_h.m4 b/gl/m4/strings_h.m4 index 12ca5eb4a2..481f8f334a 100644 --- a/gl/m4/strings_h.m4 +++ b/gl/m4/strings_h.m4 @@ -1,5 +1,5 @@ # Configure a replacement for <strings.h>. -# serial 5 +# serial 6 # Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -16,7 +16,14 @@ AC_DEFUN([gl_HEADER_STRINGS_H], AC_DEFUN([gl_HEADER_STRINGS_H_BODY], [ AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([strings.h]) + if test $ac_cv_header_strings_h = yes; then + HAVE_STRINGS_H=1 + else + HAVE_STRINGS_H=0 + fi + AC_SUBST([HAVE_STRINGS_H]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4 index fc419129e9..a3e46ca965 100644 --- a/gl/m4/sys_stat_h.m4 +++ b/gl/m4/sys_stat_h.m4 @@ -1,4 +1,4 @@ -# sys_stat_h.m4 serial 24 -*- Autoconf -*- +# sys_stat_h.m4 serial 25 -*- Autoconf -*- dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -19,6 +19,9 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H], gl_CHECK_NEXT_HEADERS([sys/stat.h]) + dnl Ensure the type mode_t gets defined. + AC_REQUIRE([AC_TYPE_MODE_T]) + dnl Define types that are supposed to be defined in <sys/types.h> or dnl <sys/stat.h>. AC_CHECK_TYPE([nlink_t], [], diff --git a/gl/m4/sys_time_h.m4 b/gl/m4/sys_time_h.m4 index 3a3adc8c47..064e0deeb7 100644 --- a/gl/m4/sys_time_h.m4 +++ b/gl/m4/sys_time_h.m4 @@ -1,5 +1,5 @@ # Configure a replacement for <sys/time.h>. -# serial 6 +# serial 7 # Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -27,6 +27,9 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], HAVE_SYS_TIME_H=0 fi + dnl On native Windows with MSVC, 'struct timeval' is defined in <winsock2.h> + dnl only. So include that header in the list. + gl_PREREQ_SYS_H_WINSOCK2 AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( @@ -34,6 +37,9 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], #include <sys/time.h> #endif #include <time.h> + #if HAVE_WINSOCK2_H + # include <winsock2.h> + #endif ]], [[static struct timeval x; x.tv_sec = x.tv_usec;]])], [gl_cv_sys_struct_timeval=yes], diff --git a/gl/m4/sys_types_h.m4 b/gl/m4/sys_types_h.m4 new file mode 100644 index 0000000000..62113df492 --- /dev/null +++ b/gl/m4/sys_types_h.m4 @@ -0,0 +1,21 @@ +# sys_types_h.m4 serial 2 +dnl Copyright (C) 2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_SYS_TYPES_H], +[ + AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) + gl_NEXT_HEADERS([sys/types.h]) + + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + + dnl Ensure the type mode_t gets defined. + AC_REQUIRE([AC_TYPE_MODE_T]) +]) + +AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], +[ +]) diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4 index 615da1cfd3..3454b23fa0 100644 --- a/gl/m4/time_h.m4 +++ b/gl/m4/time_h.m4 @@ -2,7 +2,7 @@ # Copyright (C) 2000-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc. -# serial 4 +# serial 6 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4 index fb6fe07726..720e0fd03b 100644 --- a/gl/m4/unistd_h.m4 +++ b/gl/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 56 +# unistd_h.m4 serial 59 dnl Copyright (C) 2006-2011 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,9 +21,15 @@ AC_DEFUN([gl_UNISTD_H], fi AC_SUBST([HAVE_UNISTD_H]) + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. - gl_WARN_ON_USE_PREPARE([[#include <unistd.h> + gl_WARN_ON_USE_PREPARE([[ +#if HAVE_UNISTD_H +# include <unistd.h> +#endif /* Some systems declare various items in the wrong headers. */ #if !(defined __GLIBC__ && !defined __UCLIBC__) # include <fcntl.h> @@ -34,7 +40,7 @@ AC_DEFUN([gl_UNISTD_H], # endif #endif ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat - fsync ftruncate getcwd getdomainname getdtablesize getgroups + fdatasync fsync ftruncate getcwd getdomainname getdtablesize getgroups gethostname getlogin getlogin_r getpagesize getusershell setusershell endusershell group_member lchown link linkat lseek pipe pipe2 pread pwrite readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat @@ -61,6 +67,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) + GNULIB_FDATASYNC=0; AC_SUBST([GNULIB_FDATASYNC]) GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) @@ -104,6 +111,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) + HAVE_FDATASYNC=1; AC_SUBST([HAVE_FDATASYNC]) HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) @@ -128,6 +136,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR]) + HAVE_DECL_FDATASYNC=1; AC_SUBST([HAVE_DECL_FDATASYNC]) HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME]) HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4 index 32ea985b3f..749d708d9e 100644 --- a/gl/m4/vasnprintf.m4 +++ b/gl/m4/vasnprintf.m4 @@ -1,4 +1,4 @@ -# vasnprintf.m4 serial 32 +# vasnprintf.m4 serial 33 dnl Copyright (C) 2002-2004, 2006-2011 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,7 +63,7 @@ AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) dnl Use the _snprintf function only if it is declared (because on NetBSD it dnl is defined as a weak alias of snprintf; we prefer to use the latter). - AC_CHECK_DECLS([_snprintf], , , [#include <stdio.h>]) + AC_CHECK_DECLS([_snprintf], , , [[#include <stdio.h>]]) dnl We can avoid a lot of code by assuming that snprintf's return value dnl conforms to ISO C99. So check that. AC_REQUIRE([gl_SNPRINTF_RETVAL_C99]) |