summaryrefslogtreecommitdiff
path: root/gl/m4
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2010-09-21 15:00:28 +0200
committerSimon Josefsson <simon@josefsson.org>2010-09-21 15:00:28 +0200
commita52d2b3e2f135a563ed5a7299aef5d4a0397c50d (patch)
tree17051163de8e3f6c0c7ac8a6def83ef3677d1eec /gl/m4
parent78819671f59cc4dea560b1ef3a21a04991e7822a (diff)
downloadlibtasn1-a52d2b3e2f135a563ed5a7299aef5d4a0397c50d.tar.gz
Update gnulib files.
Diffstat (limited to 'gl/m4')
-rw-r--r--gl/m4/asm-underscore.m448
-rw-r--r--gl/m4/ftello.m4130
-rw-r--r--gl/m4/getopt.m432
-rw-r--r--gl/m4/gnulib-cache.m44
-rw-r--r--gl/m4/gnulib-comp.m446
-rw-r--r--gl/m4/include_next.m411
-rw-r--r--gl/m4/lseek.m449
-rw-r--r--gl/m4/malloc.m445
-rw-r--r--gl/m4/realloc.m431
-rw-r--r--gl/m4/stdarg.m422
-rw-r--r--gl/m4/stdio_h.m4159
-rw-r--r--gl/m4/stdlib_h.m412
-rw-r--r--gl/m4/sys_stat_h.m482
-rw-r--r--gl/m4/sys_wait_h.m425
-rw-r--r--gl/m4/time_h.m4109
-rw-r--r--gl/m4/wchar_t.m412
-rw-r--r--gl/m4/wint_t.m412
17 files changed, 778 insertions, 51 deletions
diff --git a/gl/m4/asm-underscore.m4 b/gl/m4/asm-underscore.m4
new file mode 100644
index 0000000..1736cc4
--- /dev/null
+++ b/gl/m4/asm-underscore.m4
@@ -0,0 +1,48 @@
+# asm-underscore.m4 serial 1
+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,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible. Based on as-underscore.m4 in GNU clisp.
+
+# gl_ASM_SYMBOL_PREFIX
+# Tests for the prefix of C symbols at the assembly language level and the
+# linker level. This prefix is either an underscore or empty. Defines the
+# C macro USER_LABEL_PREFIX to this prefix, and sets ASM_SYMBOL_PREFIX to
+# a stringified variant of this prefix.
+
+AC_DEFUN([gl_ASM_SYMBOL_PREFIX],
+[
+ dnl We don't use GCC's __USER_LABEL_PREFIX__ here, because
+ dnl 1. It works only for GCC.
+ dnl 2. It is incorrectly defined on some platforms, in some GCC versions.
+ AC_CACHE_CHECK(
+ [whether C symbols are prefixed with underscore at the linker level],
+ [gl_cv_prog_as_underscore],
+ [cat > conftest.c <<EOF
+#ifdef __cplusplus
+extern "C" int foo (void);
+#endif
+int foo(void) { return 0; }
+EOF
+ # Look for the assembly language name in the .s file.
+ AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c) >/dev/null 2>&1
+ if grep _foo conftest.s >/dev/null ; then
+ gl_cv_prog_as_underscore=yes
+ else
+ gl_cv_prog_as_underscore=no
+ fi
+ rm -f conftest*
+ ])
+ if test $gl_cv_prog_as_underscore = yes; then
+ USER_LABEL_PREFIX=_
+ else
+ USER_LABEL_PREFIX=
+ fi
+ AC_DEFINE_UNQUOTED([USER_LABEL_PREFIX], [$USER_LABEL_PREFIX],
+ [Define to the prefix of C symbols at the assembler and linker level,
+ either an underscore or empty.])
+ ASM_SYMBOL_PREFIX='"'${USER_LABEL_PREFIX}'"'
+ AC_SUBST([ASM_SYMBOL_PREFIX])
+])
diff --git a/gl/m4/ftello.m4 b/gl/m4/ftello.m4
new file mode 100644
index 0000000..33201a0
--- /dev/null
+++ b/gl/m4/ftello.m4
@@ -0,0 +1,130 @@
+# ftello.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,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_FTELLO],
+[
+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
+
+ dnl Persuade glibc <stdio.h> to declare ftello().
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+ AC_CACHE_CHECK([for ftello], [gl_cv_func_ftello],
+ [
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdio.h>]],
+ [[ftello (stdin);]])],
+ [gl_cv_func_ftello=yes],
+ [gl_cv_func_ftello=no])
+ ])
+ if test $gl_cv_func_ftello = no; then
+ HAVE_FTELLO=0
+ else
+ if test $gl_cv_var_stdin_large_offset = no; then
+ REPLACE_FTELLO=1
+ else
+ dnl Detect bug on Solaris.
+ dnl ftell and ftello produce incorrect results after putc that followed a
+ dnl getc call that reached EOF on Solaris. This is because the _IOREAD
+ dnl flag does not get cleared in this case, even though _IOWRT gets set,
+ dnl and ftell and ftello look whether the _IOREAD flag is set.
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_CACHE_CHECK([whether ftello works],
+ [gl_cv_func_ftello_works],
+ [
+ dnl Initial guess, used when cross-compiling or when /dev/tty cannot
+ dnl be opened.
+changequote(,)dnl
+ case "$host_os" in
+ # Guess no on Solaris.
+ solaris*) gl_cv_func_ftello_works="guessing no" ;;
+ # Guess yes otherwise.
+ *) gl_cv_func_ftello_works="guessing yes" ;;
+ esac
+changequote([,])dnl
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define TESTFILE "conftest.tmp"
+int
+main (void)
+{
+ FILE *fp;
+
+ /* Create a file with some contents. */
+ fp = fopen (TESTFILE, "w");
+ if (fp == NULL)
+ return 70;
+ if (fwrite ("foogarsh", 1, 8, fp) < 8)
+ return 71;
+ if (fclose (fp))
+ return 72;
+
+ /* The file's contents is now "foogarsh". */
+
+ /* Try writing after reading to EOF. */
+ fp = fopen (TESTFILE, "r+");
+ if (fp == NULL)
+ return 73;
+ if (fseek (fp, -1, SEEK_END))
+ return 74;
+ if (!(getc (fp) == 'h'))
+ return 1;
+ if (!(getc (fp) == EOF))
+ return 2;
+ if (!(ftell (fp) == 8))
+ return 3;
+ if (!(ftell (fp) == 8))
+ return 4;
+ if (!(putc ('!', fp) == '!'))
+ return 5;
+ if (!(ftell (fp) == 9))
+ return 6;
+ if (!(fclose (fp) == 0))
+ return 7;
+ fp = fopen (TESTFILE, "r");
+ if (fp == NULL)
+ return 75;
+ {
+ char buf[10];
+ if (!(fread (buf, 1, 10, fp) == 9))
+ return 10;
+ if (!(memcmp (buf, "foogarsh!", 9) == 0))
+ return 11;
+ }
+ if (!(fclose (fp) == 0))
+ return 12;
+
+ /* The file's contents is now "foogarsh!". */
+
+ return 0;
+}]])],
+ [gl_cv_func_ftello_works=yes],
+ [gl_cv_func_ftello_works=no], [:])
+ ])
+ case "$gl_cv_func_ftello_works" in
+ *yes) ;;
+ *)
+ REPLACE_FTELLO=1
+ AC_DEFINE([FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE], [1],
+ [Define to 1 if the system's ftello function has the Solaris bug.])
+ ;;
+ esac
+ fi
+ fi
+ if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then
+ gl_REPLACE_FTELLO
+ fi
+])
+
+AC_DEFUN([gl_REPLACE_FTELLO],
+[
+ AC_LIBOBJ([ftello])
+])
diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4
index 5b211e5..d05e9d9 100644
--- a/gl/m4/getopt.m4
+++ b/gl/m4/getopt.m4
@@ -1,4 +1,4 @@
-# getopt.m4 serial 28
+# getopt.m4 serial 31
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,
@@ -50,6 +50,7 @@ AC_DEFUN([gl_GETOPT_IFELSE],
AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
[
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+ AC_REQUIRE([AC_PROG_AWK]) dnl for awk that supports ENVIRON
dnl Persuade Solaris <unistd.h> to declare optarg, optind, opterr, optopt.
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
@@ -102,7 +103,7 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
AC_CACHE_CHECK([whether getopt is POSIX compatible],
[gl_cv_func_getopt_posix],
[
- dnl This test fails on mingw and succeeds on all other platforms.
+ dnl This test fails on mingw and succeeds on many other platforms.
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <unistd.h>
#include <stdlib.h>
@@ -176,7 +177,7 @@ main ()
if (!(optind == 1))
return 12;
}
- /* Detect MacOS 10.5 bug. */
+ /* Detect MacOS 10.5, AIX 7.1 bug. */
{
char *argv[3] = { "program", "-ab", NULL };
optind = OPTIND_MIN;
@@ -196,9 +197,9 @@ main ()
]])],
[gl_cv_func_getopt_posix=yes], [gl_cv_func_getopt_posix=no],
[case "$host_os" in
- mingw*) gl_cv_func_getopt_posix="guessing no";;
- darwin*) gl_cv_func_getopt_posix="guessing no";;
- *) gl_cv_func_getopt_posix="guessing yes";;
+ mingw*) gl_cv_func_getopt_posix="guessing no";;
+ darwin* | aix*) gl_cv_func_getopt_posix="guessing no";;
+ *) gl_cv_func_getopt_posix="guessing yes";;
esac
])
])
@@ -213,7 +214,16 @@ main ()
# optstring is necessary for programs like m4 that have POSIX-mandated
# semantics for supporting options interspersed with files.
# Also, since getopt_long is a GNU extension, we require optind=0.
- gl_had_POSIXLY_CORRECT=${POSIXLY_CORRECT:+yes}
+ # Bash ties 'set -o posix' to a non-exported POSIXLY_CORRECT;
+ # so take care to revert to the correct (non-)export state.
+dnl GNU Coding Standards currently allow awk but not env; besides, env
+dnl is ambiguous with environment values that contain newlines.
+ gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }'
+ case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" </dev/null` in
+ xx) gl_had_POSIXLY_CORRECT=exported ;;
+ x) gl_had_POSIXLY_CORRECT=yes ;;
+ *) gl_had_POSIXLY_CORRECT= ;;
+ esac
POSIXLY_CORRECT=1
export POSIXLY_CORRECT
AC_RUN_IFELSE(
@@ -278,9 +288,11 @@ main ()
*) gl_cv_func_getopt_gnu=yes;;
esac
])
- if test "$gl_had_POSIXLY_CORRECT" != yes; then
- AS_UNSET([POSIXLY_CORRECT])
- fi
+ case $gl_had_POSIXLY_CORRECT in
+ exported) ;;
+ yes) AS_UNSET([POSIXLY_CORRECT]); POSIXLY_CORRECT=1 ;;
+ *) AS_UNSET([POSIXLY_CORRECT]) ;;
+ esac
])
if test "$gl_cv_func_getopt_gnu" = "no"; then
gl_replace_getopt=yes
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
index b52050d..bce314a 100644
--- a/gl/m4/gnulib-cache.m4
+++ b/gl/m4/gnulib-cache.m4
@@ -10,8 +10,8 @@
#
# This file represents the specification of how gnulib-tool is used.
# It acts as a cache: It is written and read by gnulib-tool.
-# In projects using CVS, this file is meant to be stored in CVS,
-# like the configure.ac and various Makefile.am files.
+# In projects that use version control, this file is meant to be put under
+# version control, like the configure.ac and various Makefile.am files.
# Specification in the form of a command-line invocation:
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index 731b98d..6eed7ff 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -12,7 +12,8 @@
# This file represents the compiled summary of the specification in
# gnulib-cache.m4. It lists the computed macro invocations that need
# to be invoked from configure.ac.
-# In projects using CVS, this file can be treated like other built files.
+# In projects that use version control, this file can be treated like
+# other built files.
# This macro should be invoked from ./configure.ac, in the section
@@ -32,13 +33,17 @@ AC_DEFUN([gl_EARLY],
# Code from module extensions:
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
# Code from module fdl-1.3:
+ # Code from module ftello:
+ AC_REQUIRE([AC_FUNC_FSEEKO])
# Code from module gendocs:
# Code from module getopt-gnu:
# Code from module getopt-posix:
# Code from module gettext-h:
# Code from module gnumakefile:
# Code from module include_next:
+ # Code from module lseek:
# Code from module maintainer-makefile:
+ # Code from module malloc-posix:
# Code from module manywarnings:
# Code from module multiarch:
# Code from module pmccabe2html:
@@ -53,7 +58,11 @@ AC_DEFUN([gl_EARLY],
AC_REQUIRE([AC_PROG_CC_STDC])
# Code from module stddef:
# Code from module stdint:
+ # Code from module stdio:
# Code from module stdlib:
+ # Code from module sys_stat:
+ # Code from module sys_wait:
+ # Code from module time:
# Code from module unistd:
# Code from module update-copyright:
# Code from module useless-if-before-free:
@@ -85,6 +94,9 @@ AC_DEFUN([gl_INIT],
# Code from module c++defs:
# Code from module extensions:
# Code from module fdl-1.3:
+ # Code from module ftello:
+ gl_FUNC_FTELLO
+ gl_STDIO_MODULE_INDICATOR([ftello])
# Code from module gendocs:
# Code from module getopt-gnu:
gl_FUNC_GETOPT_GNU
@@ -106,9 +118,15 @@ AC_DEFUN([gl_INIT],
[AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
[GNUmakefile=$GNUmakefile])])
# Code from module include_next:
+ # Code from module lseek:
+ gl_FUNC_LSEEK
+ gl_UNISTD_MODULE_INDICATOR([lseek])
# Code from module maintainer-makefile:
AC_CONFIG_COMMANDS_PRE([m4_ifdef([AH_HEADER],
[AC_SUBST([CONFIG_INCLUDE], m4_defn([AH_HEADER]))])])
+ # Code from module malloc-posix:
+ gl_FUNC_MALLOC_POSIX
+ gl_STDLIB_MODULE_INDICATOR([malloc-posix])
# Code from module manywarnings:
# Code from module multiarch:
gl_MULTIARCH
@@ -128,8 +146,18 @@ AC_DEFUN([gl_INIT],
gl_STDDEF_H
# Code from module stdint:
gl_STDINT_H
+ # Code from module stdio:
+ gl_STDIO_H
# Code from module stdlib:
gl_STDLIB_H
+ # Code from module sys_stat:
+ gl_HEADER_SYS_STAT_H
+ AC_PROG_MKDIR_P
+ # Code from module sys_wait:
+ gl_SYS_WAIT_H
+ AC_PROG_MKDIR_P
+ # Code from module time:
+ gl_HEADER_TIME_H
# Code from module unistd:
gl_UNISTD_H
# Code from module update-copyright:
@@ -293,11 +321,14 @@ AC_DEFUN([gl_FILE_LIST], [
build-aux/warn-on-use.h
doc/fdl-1.3.texi
doc/gendocs_template
+ lib/ftello.c
lib/getopt.c
lib/getopt.in.h
lib/getopt1.c
lib/getopt_int.h
lib/gettext.h
+ lib/lseek.c
+ lib/malloc.c
lib/progname.c
lib/progname.h
lib/read-file.c
@@ -306,19 +337,28 @@ AC_DEFUN([gl_FILE_LIST], [
lib/stdarg.in.h
lib/stddef.in.h
lib/stdint.in.h
+ lib/stdio-impl.h
+ lib/stdio-write.c
+ lib/stdio.in.h
lib/stdlib.in.h
+ lib/sys_stat.in.h
+ lib/sys_wait.in.h
+ lib/time.in.h
lib/unistd.in.h
lib/version-etc-fsf.c
lib/version-etc.c
lib/version-etc.h
lib/wchar.in.h
m4/00gnulib.m4
+ m4/asm-underscore.m4
m4/autobuild.m4
m4/extensions.m4
+ m4/ftello.m4
m4/getopt.m4
m4/gnulib-common.m4
m4/include_next.m4
m4/longlong.m4
+ m4/lseek.m4
m4/malloc.m4
m4/manywarnings.m4
m4/multiarch.m4
@@ -327,7 +367,11 @@ AC_DEFUN([gl_FILE_LIST], [
m4/stdarg.m4
m4/stddef_h.m4
m4/stdint.m4
+ m4/stdio_h.m4
m4/stdlib_h.m4
+ m4/sys_stat_h.m4
+ m4/sys_wait_h.m4
+ m4/time_h.m4
m4/unistd_h.m4
m4/valgrind-tests.m4
m4/version-etc.m4
diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4
index c7e0672..51a719b 100644
--- a/gl/m4/include_next.m4
+++ b/gl/m4/include_next.m4
@@ -1,4 +1,4 @@
-# include_next.m4 serial 14
+# include_next.m4 serial 15
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,
@@ -68,10 +68,11 @@ EOF
EOF
gl_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2"
- AC_COMPILE_IFELSE([#include <conftest.h>],
+dnl We intentionally avoid using AC_LANG_SOURCE here.
+ AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]],
[gl_cv_have_include_next=yes],
[CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2"
- AC_COMPILE_IFELSE([#include <conftest.h>],
+ AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]],
[gl_cv_have_include_next=buggy],
[gl_cv_have_include_next=no])
])
@@ -185,3 +186,7 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS],
[$gl_next_as_first_directive])
AS_VAR_POPDEF([gl_next_header])])
])
+
+# Autoconf 2.68 added warnings for our use of AC_COMPILE_IFELSE;
+# this fallback is safe for all earlier autoconf versions.
+m4_define_default([AC_LANG_DEFINES_PROVIDED])
diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4
new file mode 100644
index 0000000..b0612c7
--- /dev/null
+++ b/gl/m4/lseek.m4
@@ -0,0 +1,49 @@
+# lseek.m4 serial 6
+dnl Copyright (C) 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,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_LSEEK],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([AC_PROG_CC])
+ 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>]], [[
+ /* Exit with success only if stdin is seekable. */
+ return lseek (0, (off_t)0, SEEK_CUR) < 0;
+]])],
+ [if test -s conftest$ac_exeext \
+ && ./conftest$ac_exeext < conftest.$ac_ext \
+ && test 1 = "`echo hi \
+ | { ./conftest$ac_exeext; echo $?; cat >/dev/null; }`"; then
+ gl_cv_func_lseek_pipe=yes
+ else
+ gl_cv_func_lseek_pipe=no
+ fi],
+ [gl_cv_func_lseek_pipe=no])
+ else
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) || defined __BEOS__
+/* mingw and BeOS mistakenly return 0 when trying to seek on pipes. */
+ Choke me.
+#endif]])],
+ [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
+ fi])
+ if test $gl_cv_func_lseek_pipe = no; then
+ gl_REPLACE_LSEEK
+ fi
+])
+
+AC_DEFUN([gl_REPLACE_LSEEK],
+[
+ AC_LIBOBJ([lseek])
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ REPLACE_LSEEK=1
+ AC_DEFINE([LSEEK_PIPE_BROKEN], [1],
+ [Define to 1 if lseek does not detect pipes.])
+])
diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4
index 910ac92..7a74925 100644
--- a/gl/m4/malloc.m4
+++ b/gl/m4/malloc.m4
@@ -1,25 +1,40 @@
-# malloc.m4 serial 9
+# malloc.m4 serial 12
dnl Copyright (C) 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,
dnl with or without modifications, as long as this notice is preserved.
+# gl_FUNC_MALLOC_GNU
+# ------------------
+# Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if
+# it is not.
+AC_DEFUN([gl_FUNC_MALLOC_GNU],
+[
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+ dnl _AC_FUNC_MALLOC_IF is defined in Autoconf.
+ _AC_FUNC_MALLOC_IF(
+ [AC_DEFINE([HAVE_MALLOC_GNU], [1],
+ [Define to 1 if your system has a GNU libc compatible 'malloc'
+ function, and to 0 otherwise.])],
+ [AC_DEFINE([HAVE_MALLOC_GNU], [0])
+ gl_REPLACE_MALLOC
+ ])
+])
+
# gl_FUNC_MALLOC_POSIX
# --------------------
# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it
# fails), and replace malloc if it is not.
AC_DEFUN([gl_FUNC_MALLOC_POSIX],
[
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
if test $gl_cv_func_malloc_posix = yes; then
- HAVE_MALLOC_POSIX=1
AC_DEFINE([HAVE_MALLOC_POSIX], [1],
[Define if the 'malloc' function is POSIX compliant.])
else
- AC_LIBOBJ([malloc])
- HAVE_MALLOC_POSIX=0
+ gl_REPLACE_MALLOC
fi
- AC_SUBST([HAVE_MALLOC_POSIX])
])
# Test whether malloc, realloc, calloc are POSIX compliant,
@@ -32,10 +47,20 @@ AC_DEFUN([gl_CHECK_MALLOC_POSIX],
dnl It is too dangerous to try to allocate a large amount of memory:
dnl some systems go to their knees when you do that. So assume that
dnl all Unix implementations of the function are POSIX compliant.
- AC_TRY_COMPILE([],
- [#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- choke me
- #endif
- ], [gl_cv_func_malloc_posix=yes], [gl_cv_func_malloc_posix=no])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[]],
+ [[#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ choke me
+ #endif
+ ]])],
+ [gl_cv_func_malloc_posix=yes],
+ [gl_cv_func_malloc_posix=no])
])
])
+
+AC_DEFUN([gl_REPLACE_MALLOC],
+[
+ AC_LIBOBJ([malloc])
+ REPLACE_MALLOC=1
+])
diff --git a/gl/m4/realloc.m4 b/gl/m4/realloc.m4
index dc30235..01c1234 100644
--- a/gl/m4/realloc.m4
+++ b/gl/m4/realloc.m4
@@ -1,23 +1,44 @@
-# realloc.m4 serial 9
+# realloc.m4 serial 11
dnl Copyright (C) 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,
dnl with or without modifications, as long as this notice is preserved.
+# gl_FUNC_REALLOC_GNU
+# -------------------
+# Test whether 'realloc (0, 0)' is handled like in GNU libc, and replace
+# realloc if it is not.
+AC_DEFUN([gl_FUNC_REALLOC_GNU],
+[
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+ dnl _AC_FUNC_REALLOC_IF is defined in Autoconf.
+ _AC_FUNC_REALLOC_IF(
+ [AC_DEFINE([HAVE_REALLOC_GNU], [1],
+ [Define to 1 if your system has a GNU libc compatible 'realloc'
+ function, and to 0 otherwise.])],
+ [AC_DEFINE([HAVE_REALLOC_GNU], [0])
+ gl_REPLACE_REALLOC
+ ])
+])# gl_FUNC_REALLOC_GNU
+
# gl_FUNC_REALLOC_POSIX
# ---------------------
# Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it
# fails), and replace realloc if it is not.
AC_DEFUN([gl_FUNC_REALLOC_POSIX],
[
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
if test $gl_cv_func_malloc_posix = yes; then
- HAVE_REALLOC_POSIX=1
AC_DEFINE([HAVE_REALLOC_POSIX], [1],
[Define if the 'realloc' function is POSIX compliant.])
else
- AC_LIBOBJ([realloc])
- HAVE_REALLOC_POSIX=0
+ gl_REPLACE_REALLOC
fi
- AC_SUBST([HAVE_REALLOC_POSIX])
+])
+
+AC_DEFUN([gl_REPLACE_REALLOC],
+[
+ AC_LIBOBJ([realloc])
+ REPLACE_REALLOC=1
])
diff --git a/gl/m4/stdarg.m4 b/gl/m4/stdarg.m4
index 5c87bd8..8a62f2e 100644
--- a/gl/m4/stdarg.m4
+++ b/gl/m4/stdarg.m4
@@ -1,4 +1,4 @@
-# stdarg.m4 serial 3
+# stdarg.m4 serial 4
dnl Copyright (C) 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,
@@ -13,12 +13,16 @@ AC_DEFUN([gl_STDARG_H],
NEXT_STDARG_H='<stdarg.h>'; AC_SUBST([NEXT_STDARG_H])
AC_MSG_CHECKING([for va_copy])
AC_CACHE_VAL([gl_cv_func_va_copy], [
- AC_TRY_COMPILE([#include <stdarg.h>], [
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdarg.h>]],
+ [[
#ifndef va_copy
void (*func) (va_list, va_list) = va_copy;
#endif
-],
- [gl_cv_func_va_copy=yes], [gl_cv_func_va_copy=no])])
+ ]])],
+ [gl_cv_func_va_copy=yes],
+ [gl_cv_func_va_copy=no])])
AC_MSG_RESULT([$gl_cv_func_va_copy])
if test $gl_cv_func_va_copy = no; then
dnl Provide a substitute.
@@ -47,12 +51,16 @@ void (*func) (va_list, va_list) = va_copy;
dnl Provide a substitute in <config.h>, either __va_copy or as a simple
dnl assignment.
gl_CACHE_VAL_SILENT([gl_cv_func___va_copy], [
- AC_TRY_COMPILE([#include <stdarg.h>], [
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdarg.h>]],
+ [[
#ifndef __va_copy
error, bail out
#endif
-],
- [gl_cv_func___va_copy=yes], [gl_cv_func___va_copy=no])])
+ ]])],
+ [gl_cv_func___va_copy=yes],
+ [gl_cv_func___va_copy=no])])
if test $gl_cv_func___va_copy = yes; then
AC_DEFINE([va_copy], [__va_copy],
[Define as a macro for copying va_list variables.])
diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4
new file mode 100644
index 0000000..f5650cd
--- /dev/null
+++ b/gl/m4/stdio_h.m4
@@ -0,0 +1,159 @@
+# stdio_h.m4 serial 31
+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,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_STDIO_H],
+[
+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+ AC_REQUIRE([AC_C_INLINE])
+ AC_REQUIRE([gl_ASM_SYMBOL_PREFIX])
+ gl_CHECK_NEXT_HEADERS([stdio.h])
+ dnl No need to create extra modules for these functions. Everyone who uses
+ dnl <stdio.h> likely needs them.
+ GNULIB_FPRINTF=1
+ GNULIB_PRINTF=1
+ GNULIB_VFPRINTF=1
+ GNULIB_VPRINTF=1
+ GNULIB_FPUTC=1
+ GNULIB_PUTC=1
+ GNULIB_PUTCHAR=1
+ GNULIB_FPUTS=1
+ GNULIB_PUTS=1
+ GNULIB_FWRITE=1
+ dnl This ifdef is just an optimization, to avoid performing a configure
+ dnl check whose result is not used. It does not make the test of
+ dnl GNULIB_STDIO_H_SIGPIPE or GNULIB_SIGPIPE redundant.
+ m4_ifdef([gl_SIGNAL_SIGPIPE], [
+ gl_SIGNAL_SIGPIPE
+ if test $gl_cv_header_signal_h_SIGPIPE != yes; then
+ REPLACE_STDIO_WRITE_FUNCS=1
+ AC_LIBOBJ([stdio-write])
+ fi
+ ])
+
+ dnl Check for declarations of anything we want to poison if the
+ 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
+ snprintf tmpfile vdprintf vsnprintf])
+])
+
+AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+ gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+ dnl Define it also as a C macro, for the benefit of the unit tests.
+ gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+AC_DEFUN([gl_STDIO_H_DEFAULTS],
+[
+ GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF])
+ GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE])
+ GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH])
+ GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN])
+ GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF])
+ GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX])
+ GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE])
+ GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC])
+ GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS])
+ GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN])
+ GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK])
+ GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO])
+ GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL])
+ GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO])
+ GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE])
+ GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM])
+ GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE])
+ GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF])
+ GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
+ GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR])
+ GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN])
+ GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF])
+ GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX])
+ GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC])
+ GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR])
+ GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS])
+ GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE])
+ GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME])
+ GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT])
+ GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF])
+ GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX])
+ GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE])
+ GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE])
+ GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF])
+ GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF])
+ GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF])
+ GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX])
+ GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF])
+ GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX])
+ GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF])
+ GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX])
+ dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE])
+ HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM])
+ HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE])
+ HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF])
+ HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF])
+ HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF])
+ HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF])
+ HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
+ HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO])
+ HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT])
+ HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF])
+ HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF])
+ REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF])
+ REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE])
+ REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH])
+ REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN])
+ REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF])
+ REPLACE_FPURGE=0; AC_SUBST([REPLACE_FPURGE])
+ REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN])
+ REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK])
+ REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO])
+ REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL])
+ REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO])
+ REPLACE_GETDELIM=0; AC_SUBST([REPLACE_GETDELIM])
+ REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE])
+ REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF])
+ REPLACE_PERROR=0; AC_SUBST([REPLACE_PERROR])
+ REPLACE_POPEN=0; AC_SUBST([REPLACE_POPEN])
+ REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF])
+ REPLACE_REMOVE=0; AC_SUBST([REPLACE_REMOVE])
+ REPLACE_RENAME=0; AC_SUBST([REPLACE_RENAME])
+ REPLACE_RENAMEAT=0; AC_SUBST([REPLACE_RENAMEAT])
+ REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF])
+ REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF])
+ REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS])
+ REPLACE_TMPFILE=0; AC_SUBST([REPLACE_TMPFILE])
+ REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF])
+ REPLACE_VDPRINTF=0; AC_SUBST([REPLACE_VDPRINTF])
+ REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF])
+ REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF])
+ REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF])
+ REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF])
+])
+
+dnl Code shared by fseeko and ftello. Determine if large files are supported,
+dnl but stdin does not start as a large file by default.
+AC_DEFUN([gl_STDIN_LARGE_OFFSET],
+ [
+ AC_CACHE_CHECK([whether stdin defaults to large file offsets],
+ [gl_cv_var_stdin_large_offset],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
+[[#if defined __SL64 && defined __SCLE /* cygwin */
+ /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
+ fseeko/ftello needlessly fail. This bug was fixed in 1.5.25, and
+ it is easier to do a version check than building a runtime test. */
+# include <cygwin/version.h>
+# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
+ choke me
+# endif
+#endif]])],
+ [gl_cv_var_stdin_large_offset=yes],
+ [gl_cv_var_stdin_large_offset=no])])
+])
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4
index dd84796..fc15019 100644
--- a/gl/m4/stdlib_h.m4
+++ b/gl/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 28
+# stdlib_h.m4 serial 30
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,
@@ -33,7 +33,7 @@ AC_DEFUN([gl_STDLIB_H],
#if HAVE_RANDOM_H
# include <random.h>
#endif
- ]], [atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp
+ ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp
mkostemp mkostemps mkstemp mkstemps ptsname random_r initstat_r srandom_r
setstate_r realpath rpmatch setenv strtod strtoll strtoull unlockpt
unsetenv])
@@ -50,6 +50,7 @@ AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
AC_DEFUN([gl_STDLIB_H_DEFAULTS],
[
+ GNULIB__EXIT=0; AC_SUBST([GNULIB__EXIT])
GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL])
GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX])
GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME])
@@ -75,13 +76,12 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT])
GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV])
dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE__EXIT=1; AC_SUBST([HAVE__EXIT])
HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL])
- HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX])
HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME])
HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG])
HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT])
HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT])
- HAVE_MALLOC_POSIX=1; AC_SUBST([HAVE_MALLOC_POSIX])
HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP])
HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS])
@@ -89,7 +89,6 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS])
HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME])
HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
- HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX])
HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH])
HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH])
HAVE_SETENV=1; AC_SUBST([HAVE_SETENV])
@@ -100,9 +99,12 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H])
HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT])
HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV])
+ REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC])
REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
+ REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC])
REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
+ REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC])
REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH])
REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV])
REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD])
diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4
new file mode 100644
index 0000000..7181c25
--- /dev/null
+++ b/gl/m4/sys_stat_h.m4
@@ -0,0 +1,82 @@
+# sys_stat_h.m4 serial 24 -*- Autoconf -*-
+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,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Eric Blake.
+dnl Provide a GNU-like <sys/stat.h>.
+
+AC_DEFUN([gl_HEADER_SYS_STAT_H],
+[
+ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+
+ dnl For the mkdir substitute.
+ AC_REQUIRE([AC_C_INLINE])
+
+ dnl Check for broken stat macros.
+ AC_REQUIRE([AC_HEADER_STAT])
+
+ gl_CHECK_NEXT_HEADERS([sys/stat.h])
+
+ dnl Define types that are supposed to be defined in <sys/types.h> or
+ dnl <sys/stat.h>.
+ AC_CHECK_TYPE([nlink_t], [],
+ [AC_DEFINE([nlink_t], [int],
+ [Define to the type of st_nlink in struct stat, or a supertype.])],
+ [#include <sys/types.h>
+ #include <sys/stat.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 <sys/stat.h>
+ ]], [fchmodat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
+ mknod mknodat stat utimensat])
+]) # gl_HEADER_SYS_STAT_H
+
+AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+ gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+ dnl Define it also as a C macro, for the benefit of the unit tests.
+ gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
+ GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT])
+ GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT])
+ GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS])
+ GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
+ GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT])
+ GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT])
+ GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO])
+ GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT])
+ GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD])
+ GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT])
+ GNULIB_STAT=0; AC_SUBST([GNULIB_STAT])
+ GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT])
+ dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT])
+ HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT])
+ HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS])
+ HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD])
+ HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT])
+ HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT])
+ HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO])
+ HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT])
+ HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD])
+ HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT])
+ HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT])
+ REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT])
+ REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT])
+ REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS])
+ REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT])
+ REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
+ REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO])
+ REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD])
+ REPLACE_STAT=0; AC_SUBST([REPLACE_STAT])
+ REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT])
+])
diff --git a/gl/m4/sys_wait_h.m4 b/gl/m4/sys_wait_h.m4
new file mode 100644
index 0000000..b0d23fa
--- /dev/null
+++ b/gl/m4/sys_wait_h.m4
@@ -0,0 +1,25 @@
+# sys_wait_h.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,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_SYS_WAIT_H],
+[
+ AC_REQUIRE([gl_SYS_WAIT_H_DEFAULTS])
+
+ dnl <sys/wait.h> is always overridden, because of GNULIB_POSIXCHECK.
+ gl_CHECK_NEXT_HEADERS([sys/wait.h])
+])
+
+AC_DEFUN([gl_SYS_WAIT_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_SYS_WAIT_H_DEFAULTS])
+ gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+])
+
+AC_DEFUN([gl_SYS_WAIT_H_DEFAULTS],
+[
+ dnl Assume proper GNU behavior unless another module says otherwise.
+])
diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4
new file mode 100644
index 0000000..a45a10a
--- /dev/null
+++ b/gl/m4/time_h.m4
@@ -0,0 +1,109 @@
+# Configure a more-standard replacement for <time.h>.
+
+# Copyright (C) 2000-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc.
+
+# serial 2
+
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# Written by Paul Eggert and Jim Meyering.
+
+AC_DEFUN([gl_HEADER_TIME_H],
+[
+ dnl Use AC_REQUIRE here, so that the default behavior below is expanded
+ dnl once only, before all statements that occur in other macros.
+ AC_REQUIRE([gl_HEADER_TIME_H_BODY])
+])
+
+AC_DEFUN([gl_HEADER_TIME_H_BODY],
+[
+ AC_REQUIRE([AC_C_RESTRICT])
+ AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
+ gl_CHECK_NEXT_HEADERS([time.h])
+ AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
+])
+
+dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
+dnl in time.h, sys/time.h, or pthread.h.
+
+AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
+[
+ AC_CHECK_HEADERS_ONCE([sys/time.h])
+ AC_CACHE_CHECK([for struct timespec in <time.h>],
+ [gl_cv_sys_struct_timespec_in_time_h],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <time.h>
+ ]],
+ [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+ [gl_cv_sys_struct_timespec_in_time_h=yes],
+ [gl_cv_sys_struct_timespec_in_time_h=no])])
+
+ TIME_H_DEFINES_STRUCT_TIMESPEC=0
+ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0
+ PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0
+ if test $gl_cv_sys_struct_timespec_in_time_h = yes; then
+ TIME_H_DEFINES_STRUCT_TIMESPEC=1
+ else
+ AC_CACHE_CHECK([for struct timespec in <sys/time.h>],
+ [gl_cv_sys_struct_timespec_in_sys_time_h],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/time.h>
+ ]],
+ [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+ [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
+ [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
+ if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then
+ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1
+ else
+ AC_CACHE_CHECK([for struct timespec in <pthread.h>],
+ [gl_cv_sys_struct_timespec_in_pthread_h],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <pthread.h>
+ ]],
+ [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+ [gl_cv_sys_struct_timespec_in_pthread_h=yes],
+ [gl_cv_sys_struct_timespec_in_pthread_h=no])])
+ if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then
+ PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1
+ fi
+ fi
+ fi
+ AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC])
+ AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC])
+ AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC])
+])
+
+AC_DEFUN([gl_TIME_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
+ gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+ dnl Define it also as a C macro, for the benefit of the unit tests.
+ gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
+[
+ GNULIB_MKTIME=0; AC_SUBST([GNULIB_MKTIME])
+ GNULIB_NANOSLEEP=0; AC_SUBST([GNULIB_NANOSLEEP])
+ GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME])
+ GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM])
+ GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R])
+ dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_LOCALTIME_R=1; AC_SUBST([HAVE_LOCALTIME_R])
+ HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP])
+ HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME])
+ HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM])
+ dnl If another module says to replace or to not replace, do that.
+ dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
+ dnl this lets maintainers check for portability.
+ REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R])
+ REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME])
+ REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP])
+ REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM])
+])
diff --git a/gl/m4/wchar_t.m4 b/gl/m4/wchar_t.m4
index ed804e6..a133e6a 100644
--- a/gl/m4/wchar_t.m4
+++ b/gl/m4/wchar_t.m4
@@ -1,4 +1,4 @@
-# wchar_t.m4 serial 3 (gettext-0.18)
+# wchar_t.m4 serial 4 (gettext-0.18.2)
dnl Copyright (C) 2002-2003, 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,
@@ -11,9 +11,13 @@ dnl Prerequisite: AC_PROG_CC
AC_DEFUN([gt_TYPE_WCHAR_T],
[
AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
- [AC_TRY_COMPILE([#include <stddef.h>
- wchar_t foo = (wchar_t)'\0';], ,
- [gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])])
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stddef.h>
+ wchar_t foo = (wchar_t)'\0';]],
+ [[]])],
+ [gt_cv_c_wchar_t=yes],
+ [gt_cv_c_wchar_t=no])])
if test $gt_cv_c_wchar_t = yes; then
AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
fi
diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4
index a6c7d15..58ef865 100644
--- a/gl/m4/wint_t.m4
+++ b/gl/m4/wint_t.m4
@@ -1,4 +1,4 @@
-# wint_t.m4 serial 4 (gettext-0.18)
+# wint_t.m4 serial 5 (gettext-0.18.2)
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,
@@ -11,7 +11,9 @@ dnl Prerequisite: AC_PROG_CC
AC_DEFUN([gt_TYPE_WINT_T],
[
AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
- [AC_TRY_COMPILE([
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
<wchar.h>.
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
@@ -20,8 +22,10 @@ AC_DEFUN([gt_TYPE_WINT_T],
#include <stdio.h>
#include <time.h>
#include <wchar.h>
- wint_t foo = (wchar_t)'\0';], ,
- [gt_cv_c_wint_t=yes], [gt_cv_c_wint_t=no])])
+ wint_t foo = (wchar_t)'\0';]],
+ [[]])],
+ [gt_cv_c_wint_t=yes],
+ [gt_cv_c_wint_t=no])])
if test $gt_cv_c_wint_t = yes; then
AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
fi