summaryrefslogtreecommitdiffstats
path: root/gl/m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4')
-rw-r--r--gl/m4/00gnulib.m42
-rw-r--r--gl/m4/alloca.m486
-rw-r--r--gl/m4/arpa_inet_h.m420
-rw-r--r--gl/m4/asm-underscore.m448
-rw-r--r--gl/m4/base64.m45
-rw-r--r--gl/m4/btowc.m435
-rw-r--r--gl/m4/c-strtod.m457
-rw-r--r--gl/m4/codeset.m414
-rw-r--r--gl/m4/configmake.m450
-rw-r--r--gl/m4/dirname.m411
-rw-r--r--gl/m4/dos.m471
-rw-r--r--gl/m4/double-slash-root.m42
-rw-r--r--gl/m4/dup2.m458
-rw-r--r--gl/m4/eealloc.m45
-rw-r--r--gl/m4/environ.m427
-rw-r--r--gl/m4/errno_h.m428
-rw-r--r--gl/m4/error.m417
-rw-r--r--gl/m4/exponentd.m4116
-rw-r--r--gl/m4/extensions.m456
-rw-r--r--gl/m4/extern-inline.m470
-rw-r--r--gl/m4/fcntl-o.m495
-rw-r--r--gl/m4/fcntl-safer.m419
-rw-r--r--gl/m4/fcntl.m483
-rw-r--r--gl/m4/fcntl_h.m443
-rw-r--r--gl/m4/float_h.m487
-rw-r--r--gl/m4/floorf.m484
-rw-r--r--gl/m4/fstypename.m42
-rw-r--r--gl/m4/fsusage.m4127
-rw-r--r--gl/m4/getaddrinfo.m466
-rw-r--r--gl/m4/getdtablesize.m415
-rw-r--r--gl/m4/gethostname.m420
-rw-r--r--gl/m4/getloadavg.m4185
-rw-r--r--gl/m4/getopt.m4402
-rw-r--r--gl/m4/gettext.m458
-rw-r--r--gl/m4/glibc2.m47
-rw-r--r--gl/m4/glibc21.m414
-rw-r--r--gl/m4/gnulib-cache.m431
-rw-r--r--gl/m4/gnulib-common.m4192
-rw-r--r--gl/m4/gnulib-comp.m4489
-rw-r--r--gl/m4/gnulib-tool.m42
-rw-r--r--gl/m4/hostent.m412
-rw-r--r--gl/m4/iconv.m4110
-rw-r--r--gl/m4/include_next.m4167
-rw-r--r--gl/m4/inet_ntop.m464
-rw-r--r--gl/m4/inline.m440
-rw-r--r--gl/m4/intdiv0.m415
-rw-r--r--gl/m4/intl.m447
-rw-r--r--gl/m4/intldir.m42
-rw-r--r--gl/m4/intlmacosx.m425
-rw-r--r--gl/m4/intmax.m413
-rw-r--r--gl/m4/intmax_t.m415
-rw-r--r--gl/m4/inttypes-pri.m416
-rw-r--r--gl/m4/inttypes_h.m419
-rw-r--r--gl/m4/langinfo_h.m434
-rw-r--r--gl/m4/largefile.m4146
-rw-r--r--gl/m4/lcmessage.m412
-rw-r--r--gl/m4/lib-ld.m477
-rw-r--r--gl/m4/lib-link.m411
-rw-r--r--gl/m4/lib-prefix.m42
-rw-r--r--gl/m4/localcharset.m42
-rw-r--r--gl/m4/locale-fr.m4161
-rw-r--r--gl/m4/locale-ja.m497
-rw-r--r--gl/m4/locale-zh.m480
-rw-r--r--gl/m4/locale_h.m480
-rw-r--r--gl/m4/localeconv.m422
-rw-r--r--gl/m4/lock.m425
-rw-r--r--gl/m4/longlong.m487
-rw-r--r--gl/m4/ls-mntd-fs.m431
-rw-r--r--gl/m4/malloc.m479
-rw-r--r--gl/m4/malloca.m42
-rw-r--r--gl/m4/math_h.m4287
-rw-r--r--gl/m4/mbrtowc.m4281
-rw-r--r--gl/m4/mbsinit.m433
-rw-r--r--gl/m4/mbstate_t.m413
-rw-r--r--gl/m4/mbtowc.m419
-rw-r--r--gl/m4/memchr.m431
-rw-r--r--gl/m4/mktime.m4145
-rw-r--r--gl/m4/mmap-anon.m418
-rw-r--r--gl/m4/mode_t.m426
-rw-r--r--gl/m4/mountlist.m48
-rw-r--r--gl/m4/msvc-inval.m419
-rw-r--r--gl/m4/msvc-nothrow.m4 (renamed from gl/m4/cloexec.m4)8
-rw-r--r--gl/m4/multiarch.m411
-rw-r--r--gl/m4/netdb_h.m48
-rw-r--r--gl/m4/netinet_in_h.m45
-rw-r--r--gl/m4/nl_langinfo.m435
-rw-r--r--gl/m4/nls.m42
-rw-r--r--gl/m4/nocrash.m4130
-rw-r--r--gl/m4/off_t.m418
-rw-r--r--gl/m4/onceonly.m425
-rw-r--r--gl/m4/open.m474
-rw-r--r--gl/m4/po.m436
-rw-r--r--gl/m4/printf-posix.m423
-rw-r--r--gl/m4/printf.m41044
-rw-r--r--gl/m4/progtest.m421
-rw-r--r--gl/m4/read.m426
-rw-r--r--gl/m4/regex.m4157
-rw-r--r--gl/m4/safe-read.m411
-rw-r--r--gl/m4/safe-write.m418
-rw-r--r--gl/m4/servent.m412
-rw-r--r--gl/m4/setenv.m4127
-rw-r--r--gl/m4/sha1.m48
-rw-r--r--gl/m4/size_max.m416
-rw-r--r--gl/m4/snprintf.m420
-rw-r--r--gl/m4/socketlib.m486
-rw-r--r--gl/m4/sockets.m479
-rw-r--r--gl/m4/socklen.m455
-rw-r--r--gl/m4/sockpfaf.m430
-rw-r--r--gl/m4/ssize_t.m412
-rw-r--r--gl/m4/stat.m463
-rw-r--r--gl/m4/stdalign.m453
-rw-r--r--gl/m4/stdbool.m4137
-rw-r--r--gl/m4/stddef_h.m410
-rw-r--r--gl/m4/stdint.m440
-rw-r--r--gl/m4/stdint_h.m417
-rw-r--r--gl/m4/stdio_h.m497
-rw-r--r--gl/m4/stdlib_h.m457
-rw-r--r--gl/m4/strdup.m445
-rw-r--r--gl/m4/strerror.m4116
-rw-r--r--gl/m4/string_h.m420
-rw-r--r--gl/m4/strndup.m432
-rw-r--r--gl/m4/strnlen.m412
-rw-r--r--gl/m4/strsep.m48
-rw-r--r--gl/m4/strstr.m491
-rw-r--r--gl/m4/sys_socket_h.m447
-rw-r--r--gl/m4/sys_stat_h.m482
-rw-r--r--gl/m4/sys_types_h.m424
-rw-r--r--gl/m4/sys_uio_h.m431
-rw-r--r--gl/m4/threadlib.m4136
-rw-r--r--gl/m4/time_h.m410
-rw-r--r--gl/m4/time_r.m414
-rw-r--r--gl/m4/timegm.m422
-rw-r--r--gl/m4/uintmax_t.m42
-rw-r--r--gl/m4/unistd-safer.m413
-rw-r--r--gl/m4/unistd_h.m4137
-rw-r--r--gl/m4/vasnprintf.m415
-rw-r--r--gl/m4/vasprintf.m42
-rw-r--r--gl/m4/visibility.m425
-rw-r--r--gl/m4/vsnprintf.m420
-rw-r--r--gl/m4/warn-on-use.m414
-rw-r--r--gl/m4/wchar_h.m4123
-rw-r--r--gl/m4/wchar_t.m414
-rw-r--r--gl/m4/wcrtomb.m449
-rw-r--r--gl/m4/wctype_h.m4181
-rw-r--r--gl/m4/wint_t.m414
-rw-r--r--gl/m4/write.m420
-rw-r--r--gl/m4/xalloc.m424
-rw-r--r--gl/m4/xsize.m45
-rw-r--r--gl/m4/xstrndup.m42
149 files changed, 5740 insertions, 3353 deletions
diff --git a/gl/m4/00gnulib.m4 b/gl/m4/00gnulib.m4
index 301469b..d4ad759 100644
--- a/gl/m4/00gnulib.m4
+++ b/gl/m4/00gnulib.m4
@@ -1,5 +1,5 @@
1# 00gnulib.m4 serial 2 1# 00gnulib.m4 serial 2
2dnl Copyright (C) 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
diff --git a/gl/m4/alloca.m4 b/gl/m4/alloca.m4
index f3ee343..270abd0 100644
--- a/gl/m4/alloca.m4
+++ b/gl/m4/alloca.m4
@@ -1,5 +1,5 @@
1# alloca.m4 serial 9 1# alloca.m4 serial 14
2dnl Copyright (C) 2002-2004, 2006-2007, 2009-2010 Free Software Foundation, 2dnl Copyright (C) 2002-2004, 2006-2007, 2009-2013 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -7,10 +7,6 @@ dnl with or without modifications, as long as this notice is preserved.
7 7
8AC_DEFUN([gl_FUNC_ALLOCA], 8AC_DEFUN([gl_FUNC_ALLOCA],
9[ 9[
10 dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
11 AC_REQUIRE([AC_PROG_CPP])
12 AC_REQUIRE([AC_PROG_EGREP])
13
14 AC_REQUIRE([AC_FUNC_ALLOCA]) 10 AC_REQUIRE([AC_FUNC_ALLOCA])
15 if test $ac_cv_func_alloca_works = no; then 11 if test $ac_cv_func_alloca_works = no; then
16 gl_PREREQ_ALLOCA 12 gl_PREREQ_ALLOCA
@@ -40,8 +36,86 @@ AC_DEFUN([gl_FUNC_ALLOCA],
40 ALLOCA_H=alloca.h 36 ALLOCA_H=alloca.h
41 fi 37 fi
42 AC_SUBST([ALLOCA_H]) 38 AC_SUBST([ALLOCA_H])
39 AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"])
43]) 40])
44 41
45# Prerequisites of lib/alloca.c. 42# Prerequisites of lib/alloca.c.
46# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA. 43# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
47AC_DEFUN([gl_PREREQ_ALLOCA], [:]) 44AC_DEFUN([gl_PREREQ_ALLOCA], [:])
45
46# This works around a bug in autoconf <= 2.68.
47# See <http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00277.html>.
48
49m4_version_prereq([2.69], [] ,[
50
51# This is taken from the following Autoconf patch:
52# http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497
53
54# _AC_LIBOBJ_ALLOCA
55# -----------------
56# Set up the LIBOBJ replacement of 'alloca'. Well, not exactly
57# AC_LIBOBJ since we actually set the output variable 'ALLOCA'.
58# Nevertheless, for Automake, AC_LIBSOURCES it.
59m4_define([_AC_LIBOBJ_ALLOCA],
60[# The SVR3 libPW and SVR4 libucb both contain incompatible functions
61# that cause trouble. Some versions do not even contain alloca or
62# contain a buggy version. If you still want to use their alloca,
63# use ar to extract alloca.o from them instead of compiling alloca.c.
64AC_LIBSOURCES(alloca.c)
65AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl
66AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using 'alloca.c'.])
67
68AC_CACHE_CHECK(whether 'alloca.c' needs Cray hooks, ac_cv_os_cray,
69[AC_EGREP_CPP(webecray,
70[#if defined CRAY && ! defined CRAY2
71webecray
72#else
73wenotbecray
74#endif
75], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
76if test $ac_cv_os_cray = yes; then
77 for ac_func in _getb67 GETB67 getb67; do
78 AC_CHECK_FUNC($ac_func,
79 [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
80 [Define to one of '_getb67', 'GETB67',
81 'getb67' for Cray-2 and Cray-YMP
82 systems. This function is required for
83 'alloca.c' support on those systems.])
84 break])
85 done
86fi
87
88AC_CACHE_CHECK([stack direction for C alloca],
89 [ac_cv_c_stack_direction],
90[AC_RUN_IFELSE([AC_LANG_SOURCE(
91[AC_INCLUDES_DEFAULT
92int
93find_stack_direction (int *addr, int depth)
94{
95 int dir, dummy = 0;
96 if (! addr)
97 addr = &dummy;
98 *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
99 dir = depth ? find_stack_direction (addr, depth - 1) : 0;
100 return dir + dummy;
101}
102
103int
104main (int argc, char **argv)
105{
106 return find_stack_direction (0, argc + !argv + 20) < 0;
107}])],
108 [ac_cv_c_stack_direction=1],
109 [ac_cv_c_stack_direction=-1],
110 [ac_cv_c_stack_direction=0])])
111AH_VERBATIM([STACK_DIRECTION],
112[/* If using the C implementation of alloca, define if you know the
113 direction of stack growth for your system; otherwise it will be
114 automatically deduced at runtime.
115 STACK_DIRECTION > 0 => grows toward higher addresses
116 STACK_DIRECTION < 0 => grows toward lower addresses
117 STACK_DIRECTION = 0 => direction of growth unknown */
118@%:@undef STACK_DIRECTION])dnl
119AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
120])# _AC_LIBOBJ_ALLOCA
121])
diff --git a/gl/m4/arpa_inet_h.m4 b/gl/m4/arpa_inet_h.m4
index 15a30e2..ea69af5 100644
--- a/gl/m4/arpa_inet_h.m4
+++ b/gl/m4/arpa_inet_h.m4
@@ -1,5 +1,5 @@
1# arpa_inet_h.m4 serial 8 1# arpa_inet_h.m4 serial 13
2dnl Copyright (C) 2006, 2008, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -22,24 +22,22 @@ AC_DEFUN([gl_HEADER_ARPA_INET],
22 dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK. 22 dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK.
23 gl_CHECK_NEXT_HEADERS([arpa/inet.h]) 23 gl_CHECK_NEXT_HEADERS([arpa/inet.h])
24 24
25 AC_REQUIRE([gl_FEATURES_H])
26
25 dnl Check for declarations of anything we want to poison if the 27 dnl Check for declarations of anything we want to poison if the
26 dnl corresponding gnulib module is not in use. 28 dnl corresponding gnulib module is not in use.
27 gl_WARN_ON_USE_PREPARE([[ 29 gl_WARN_ON_USE_PREPARE([[
28/* On some systems, this header is not self-consistent. */ 30/* On some systems, this header is not self-consistent. */
29#ifndef __GLIBC__ 31#if !(defined __GLIBC__ || defined __UCLIBC__)
30# include <sys/socket.h> 32# include <sys/socket.h>
31#endif 33#endif
34#ifdef __TANDEM
35# include <netdb.h>
36#endif
32#include <arpa/inet.h> 37#include <arpa/inet.h>
33 ]], [inet_ntop inet_pton]) 38 ]], [inet_ntop inet_pton])
34]) 39])
35 40
36dnl Unconditionally enables the replacement of <arpa/inet.h>.
37AC_DEFUN([gl_REPLACE_ARPA_INET_H],
38[
39 dnl This is a no-op, because <arpa/inet.h> is always overridden.
40 :
41])
42
43AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR], 41AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
44[ 42[
45 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 43 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
@@ -54,4 +52,6 @@ AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
54 dnl Assume proper GNU behavior unless another module says otherwise. 52 dnl Assume proper GNU behavior unless another module says otherwise.
55 HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP]) 53 HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP])
56 HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON]) 54 HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON])
55 REPLACE_INET_NTOP=0; AC_SUBST([REPLACE_INET_NTOP])
56 REPLACE_INET_PTON=0; AC_SUBST([REPLACE_INET_PTON])
57]) 57])
diff --git a/gl/m4/asm-underscore.m4 b/gl/m4/asm-underscore.m4
deleted file mode 100644
index 1736cc4..0000000
--- a/gl/m4/asm-underscore.m4
+++ /dev/null
@@ -1,48 +0,0 @@
1# asm-underscore.m4 serial 1
2dnl Copyright (C) 2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Bruno Haible. Based on as-underscore.m4 in GNU clisp.
8
9# gl_ASM_SYMBOL_PREFIX
10# Tests for the prefix of C symbols at the assembly language level and the
11# linker level. This prefix is either an underscore or empty. Defines the
12# C macro USER_LABEL_PREFIX to this prefix, and sets ASM_SYMBOL_PREFIX to
13# a stringified variant of this prefix.
14
15AC_DEFUN([gl_ASM_SYMBOL_PREFIX],
16[
17 dnl We don't use GCC's __USER_LABEL_PREFIX__ here, because
18 dnl 1. It works only for GCC.
19 dnl 2. It is incorrectly defined on some platforms, in some GCC versions.
20 AC_CACHE_CHECK(
21 [whether C symbols are prefixed with underscore at the linker level],
22 [gl_cv_prog_as_underscore],
23 [cat > conftest.c <<EOF
24#ifdef __cplusplus
25extern "C" int foo (void);
26#endif
27int foo(void) { return 0; }
28EOF
29 # Look for the assembly language name in the .s file.
30 AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c) >/dev/null 2>&1
31 if grep _foo conftest.s >/dev/null ; then
32 gl_cv_prog_as_underscore=yes
33 else
34 gl_cv_prog_as_underscore=no
35 fi
36 rm -f conftest*
37 ])
38 if test $gl_cv_prog_as_underscore = yes; then
39 USER_LABEL_PREFIX=_
40 else
41 USER_LABEL_PREFIX=
42 fi
43 AC_DEFINE_UNQUOTED([USER_LABEL_PREFIX], [$USER_LABEL_PREFIX],
44 [Define to the prefix of C symbols at the assembler and linker level,
45 either an underscore or empty.])
46 ASM_SYMBOL_PREFIX='"'${USER_LABEL_PREFIX}'"'
47 AC_SUBST([ASM_SYMBOL_PREFIX])
48])
diff --git a/gl/m4/base64.m4 b/gl/m4/base64.m4
index d1e1352..fc19893 100644
--- a/gl/m4/base64.m4
+++ b/gl/m4/base64.m4
@@ -1,5 +1,5 @@
1# base64.m4 serial 3 1# base64.m4 serial 4
2dnl Copyright (C) 2004, 2006, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2004, 2006, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -11,6 +11,5 @@ AC_DEFUN([gl_FUNC_BASE64],
11 11
12# Prerequisites of lib/base64.c. 12# Prerequisites of lib/base64.c.
13AC_DEFUN([gl_PREREQ_BASE64], [ 13AC_DEFUN([gl_PREREQ_BASE64], [
14 AC_REQUIRE([AC_C_INLINE])
15 AC_REQUIRE([AC_C_RESTRICT]) 14 AC_REQUIRE([AC_C_RESTRICT])
16]) 15])
diff --git a/gl/m4/btowc.m4 b/gl/m4/btowc.m4
index c4ee4e4..978a06e 100644
--- a/gl/m4/btowc.m4
+++ b/gl/m4/btowc.m4
@@ -1,5 +1,5 @@
1# btowc.m4 serial 6 1# btowc.m4 serial 10
2dnl Copyright (C) 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -26,16 +26,23 @@ AC_DEFUN([gl_FUNC_BTOWC],
26 AC_CACHE_CHECK([whether btowc(0) is correct], 26 AC_CACHE_CHECK([whether btowc(0) is correct],
27 [gl_cv_func_btowc_nul], 27 [gl_cv_func_btowc_nul],
28 [ 28 [
29 AC_TRY_RUN([ 29 AC_RUN_IFELSE(
30#include <stdio.h> 30 [AC_LANG_SOURCE([[
31#include <string.h> 31#include <string.h>
32/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
33 <wchar.h>.
34 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
35 included before <wchar.h>. */
36#include <stddef.h>
37#include <stdio.h>
38#include <time.h>
32#include <wchar.h> 39#include <wchar.h>
33int main () 40int main ()
34{ 41{
35 if (btowc ('\0') != 0) 42 if (btowc ('\0') != 0)
36 return 1; 43 return 1;
37 return 0; 44 return 0;
38}], 45}]])],
39 [gl_cv_func_btowc_nul=yes], 46 [gl_cv_func_btowc_nul=yes],
40 [gl_cv_func_btowc_nul=no], 47 [gl_cv_func_btowc_nul=no],
41 [ 48 [
@@ -65,10 +72,17 @@ changequote(,)dnl
65 esac 72 esac
66changequote([,])dnl 73changequote([,])dnl
67 if test $LOCALE_FR != none; then 74 if test $LOCALE_FR != none; then
68 AC_TRY_RUN([ 75 AC_RUN_IFELSE(
76 [AC_LANG_SOURCE([[
69#include <locale.h> 77#include <locale.h>
70#include <stdio.h>
71#include <string.h> 78#include <string.h>
79/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
80 <wchar.h>.
81 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
82 included before <wchar.h>. */
83#include <stddef.h>
84#include <stdio.h>
85#include <time.h>
72#include <wchar.h> 86#include <wchar.h>
73int main () 87int main ()
74{ 88{
@@ -78,7 +92,7 @@ int main ()
78 return 1; 92 return 1;
79 } 93 }
80 return 0; 94 return 0;
81}], 95}]])],
82 [gl_cv_func_btowc_eof=yes], 96 [gl_cv_func_btowc_eof=yes],
83 [gl_cv_func_btowc_eof=no], 97 [gl_cv_func_btowc_eof=no],
84 [:]) 98 [:])
@@ -94,11 +108,6 @@ int main ()
94 *) REPLACE_BTOWC=1 ;; 108 *) REPLACE_BTOWC=1 ;;
95 esac 109 esac
96 fi 110 fi
97 if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then
98 gl_REPLACE_WCHAR_H
99 AC_LIBOBJ([btowc])
100 gl_PREREQ_BTOWC
101 fi
102]) 111])
103 112
104# Prerequisites of lib/btowc.c. 113# Prerequisites of lib/btowc.c.
diff --git a/gl/m4/c-strtod.m4 b/gl/m4/c-strtod.m4
deleted file mode 100644
index 41cf18e..0000000
--- a/gl/m4/c-strtod.m4
+++ /dev/null
@@ -1,57 +0,0 @@
1# c-strtod.m4 serial 11
2
3# Copyright (C) 2004-2006, 2009-2010 Free Software Foundation, Inc.
4# This file is free software; the Free Software Foundation
5# gives unlimited permission to copy and/or distribute it,
6# with or without modifications, as long as this notice is preserved.
7
8# Written by Paul Eggert.
9
10AC_DEFUN([gl_C99_STRTOLD],
11[
12 AC_CACHE_CHECK([whether strtold conforms to C99],
13 [gl_cv_func_c99_strtold],
14 [AC_LINK_IFELSE(
15 [AC_LANG_PROGRAM(
16 [[/* On HP-UX before 11.23, strtold returns a struct instead of
17 long double. Reject implementations like that, by requiring
18 compatibility with the C99 prototype. */
19 #include <stdlib.h>
20 static long double (*p) (char const *, char **) = strtold;
21 static long double
22 test (char const *nptr, char **endptr)
23 {
24 long double r;
25 r = strtold (nptr, endptr);
26 return r;
27 }]],
28 [[return test ("1.0", NULL) != 1 || p ("1.0", NULL) != 1;]])],
29 [gl_cv_func_c99_strtold=yes],
30 [gl_cv_func_c99_strtold=no])])
31 if test $gl_cv_func_c99_strtold = yes; then
32 AC_DEFINE([HAVE_C99_STRTOLD], [1], [Define to 1 if strtold conforms to C99.])
33 fi
34])
35
36AC_DEFUN([gl_C_STRTOD],
37[
38 AC_LIBOBJ([c-strtod])
39
40 dnl Prerequisites of lib/c-strtod.c.
41 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
42
43 AC_REQUIRE([AC_C_INLINE])
44 :
45])
46
47AC_DEFUN([gl_C_STRTOLD],
48[
49 AC_LIBOBJ([c-strtold])
50
51 dnl Prerequisites of lib/c-strtold.c.
52 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
53 AC_REQUIRE([gl_C99_STRTOLD])
54
55 AC_REQUIRE([AC_C_INLINE])
56 :
57])
diff --git a/gl/m4/codeset.m4 b/gl/m4/codeset.m4
index a53c042..c2761be 100644
--- a/gl/m4/codeset.m4
+++ b/gl/m4/codeset.m4
@@ -1,5 +1,5 @@
1# codeset.m4 serial 4 (gettext-0.18) 1# codeset.m4 serial 5 (gettext-0.18.2)
2dnl Copyright (C) 2000-2002, 2006, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2006, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -9,10 +9,12 @@ dnl From Bruno Haible.
9AC_DEFUN([AM_LANGINFO_CODESET], 9AC_DEFUN([AM_LANGINFO_CODESET],
10[ 10[
11 AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset], 11 AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset],
12 [AC_TRY_LINK([#include <langinfo.h>], 12 [AC_LINK_IFELSE(
13 [char* cs = nl_langinfo(CODESET); return !cs;], 13 [AC_LANG_PROGRAM(
14 [am_cv_langinfo_codeset=yes], 14 [[#include <langinfo.h>]],
15 [am_cv_langinfo_codeset=no]) 15 [[char* cs = nl_langinfo(CODESET); return !cs;]])],
16 [am_cv_langinfo_codeset=yes],
17 [am_cv_langinfo_codeset=no])
16 ]) 18 ])
17 if test $am_cv_langinfo_codeset = yes; then 19 if test $am_cv_langinfo_codeset = yes; then
18 AC_DEFINE([HAVE_LANGINFO_CODESET], [1], 20 AC_DEFINE([HAVE_LANGINFO_CODESET], [1],
diff --git a/gl/m4/configmake.m4 b/gl/m4/configmake.m4
new file mode 100644
index 0000000..823ffc0
--- /dev/null
+++ b/gl/m4/configmake.m4
@@ -0,0 +1,50 @@
1# configmake.m4 serial 1
2dnl Copyright (C) 2010-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7# gl_CONFIGMAKE_PREP
8# ------------------
9# Guarantee all of the standard directory variables, even when used with
10# autoconf 2.59 (datarootdir wasn't supported until 2.59c) or automake
11# 1.9.6 (pkglibexecdir wasn't supported until 1.10b.).
12AC_DEFUN([gl_CONFIGMAKE_PREP],
13[
14 dnl Technically, datadir should default to datarootdir. But if
15 dnl autoconf is too old to provide datarootdir, then reversing the
16 dnl definition is a reasonable compromise. Only AC_SUBST a variable
17 dnl if it was not already defined earlier by autoconf.
18 if test "x$datarootdir" = x; then
19 AC_SUBST([datarootdir], ['${datadir}'])
20 fi
21 dnl Copy the approach used in autoconf 2.60.
22 if test "x$docdir" = x; then
23 AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME],
24 ['${datarootdir}/doc/${PACKAGE_TARNAME}'],
25 ['${datarootdir}/doc/${PACKAGE}'])])
26 fi
27 dnl The remaining variables missing from autoconf 2.59 are easier.
28 if test "x$htmldir" = x; then
29 AC_SUBST([htmldir], ['${docdir}'])
30 fi
31 if test "x$dvidir" = x; then
32 AC_SUBST([dvidir], ['${docdir}'])
33 fi
34 if test "x$pdfdir" = x; then
35 AC_SUBST([pdfdir], ['${docdir}'])
36 fi
37 if test "x$psdir" = x; then
38 AC_SUBST([psdir], ['${docdir}'])
39 fi
40 if test "x$lispdir" = x; then
41 AC_SUBST([lispdir], ['${datarootdir}/emacs/site-lisp'])
42 fi
43 if test "x$localedir" = x; then
44 AC_SUBST([localedir], ['${datarootdir}/locale'])
45 fi
46
47 dnl Automake 1.9.6 only lacks pkglibexecdir; and since 1.11 merely
48 dnl provides it without AC_SUBST, this blind use of AC_SUBST is safe.
49 AC_SUBST([pkglibexecdir], ['${libexecdir}/${PACKAGE}'])
50])
diff --git a/gl/m4/dirname.m4 b/gl/m4/dirname.m4
index 576b5be..5897a2a 100644
--- a/gl/m4/dirname.m4
+++ b/gl/m4/dirname.m4
@@ -1,5 +1,5 @@
1#serial 8 -*- autoconf -*- 1#serial 10 -*- autoconf -*-
2dnl Copyright (C) 2002-2006, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -7,18 +7,11 @@ dnl with or without modifications, as long as this notice is preserved.
7AC_DEFUN([gl_DIRNAME], 7AC_DEFUN([gl_DIRNAME],
8[ 8[
9 AC_REQUIRE([gl_DIRNAME_LGPL]) 9 AC_REQUIRE([gl_DIRNAME_LGPL])
10 AC_LIBOBJ([basename])
11 AC_LIBOBJ([dirname])
12]) 10])
13 11
14AC_DEFUN([gl_DIRNAME_LGPL], 12AC_DEFUN([gl_DIRNAME_LGPL],
15[ 13[
16 AC_LIBOBJ([basename-lgpl])
17 AC_LIBOBJ([dirname-lgpl])
18 AC_LIBOBJ([stripslash])
19
20 dnl Prerequisites of lib/dirname.h. 14 dnl Prerequisites of lib/dirname.h.
21 AC_REQUIRE([gl_AC_DOS])
22 AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) 15 AC_REQUIRE([gl_DOUBLE_SLASH_ROOT])
23 16
24 dnl No prerequisites of lib/basename-lgpl.c, lib/dirname-lgpl.c, 17 dnl No prerequisites of lib/basename-lgpl.c, lib/dirname-lgpl.c,
diff --git a/gl/m4/dos.m4 b/gl/m4/dos.m4
deleted file mode 100644
index 5660542..0000000
--- a/gl/m4/dos.m4
+++ /dev/null
@@ -1,71 +0,0 @@
1#serial 11 -*- autoconf -*-
2
3# Define some macros required for proper operation of code in lib/*.c
4# on MSDOS/Windows systems.
5
6# Copyright (C) 2000-2001, 2004-2006, 2009-2010 Free Software Foundation, Inc.
7# This file is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# From Jim Meyering.
12
13AC_DEFUN([gl_AC_DOS],
14 [
15 AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
16 [
17 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
18#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__
19neither MSDOS nor Windows
20#endif]])],
21 [ac_cv_win_or_dos=yes],
22 [ac_cv_win_or_dos=no])
23 ])
24
25 if test x"$ac_cv_win_or_dos" = xyes; then
26 ac_fs_accepts_drive_letter_prefix=1
27 ac_fs_backslash_is_file_name_separator=1
28 AC_CACHE_CHECK([whether drive letter can start relative path],
29 [ac_cv_drive_letter_can_be_relative],
30 [
31 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
32#if defined __CYGWIN__
33drive letters are always absolute
34#endif]])],
35 [ac_cv_drive_letter_can_be_relative=yes],
36 [ac_cv_drive_letter_can_be_relative=no])
37 ])
38 if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then
39 ac_fs_drive_letter_can_be_relative=1
40 else
41 ac_fs_drive_letter_can_be_relative=0
42 fi
43 else
44 ac_fs_accepts_drive_letter_prefix=0
45 ac_fs_backslash_is_file_name_separator=0
46 ac_fs_drive_letter_can_be_relative=0
47 fi
48
49 AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
50 $ac_fs_accepts_drive_letter_prefix,
51 [Define on systems for which file names may have a so-called
52 `drive letter' prefix, define this to compute the length of that
53 prefix, including the colon.])
54
55 AH_VERBATIM(ISSLASH,
56 [#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
57# define ISSLASH(C) ((C) == '/' || (C) == '\\')
58#else
59# define ISSLASH(C) ((C) == '/')
60#endif])
61
62 AC_DEFINE_UNQUOTED([FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
63 $ac_fs_backslash_is_file_name_separator,
64 [Define if the backslash character may also serve as a file name
65 component separator.])
66
67 AC_DEFINE_UNQUOTED([FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE],
68 $ac_fs_drive_letter_can_be_relative,
69 [Define if a drive letter prefix denotes a relative path if it is
70 not followed by a file name component separator.])
71 ])
diff --git a/gl/m4/double-slash-root.m4 b/gl/m4/double-slash-root.m4
index 66a79c0..bd6f867 100644
--- a/gl/m4/double-slash-root.m4
+++ b/gl/m4/double-slash-root.m4
@@ -1,5 +1,5 @@
1# double-slash-root.m4 serial 4 -*- Autoconf -*- 1# double-slash-root.m4 serial 4 -*- Autoconf -*-
2dnl Copyright (C) 2006, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
diff --git a/gl/m4/dup2.m4 b/gl/m4/dup2.m4
deleted file mode 100644
index 998d66f..0000000
--- a/gl/m4/dup2.m4
+++ /dev/null
@@ -1,58 +0,0 @@
1#serial 10
2dnl Copyright (C) 2002, 2005, 2007, 2009-2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_DUP2],
8[
9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
10 AC_REQUIRE([AC_CANONICAL_HOST])
11 AC_CHECK_FUNCS_ONCE([dup2])
12 if test $ac_cv_func_dup2 = no; then
13 HAVE_DUP2=0
14 AC_LIBOBJ([dup2])
15 else
16 AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works],
17 [AC_RUN_IFELSE([
18 AC_LANG_PROGRAM([[#include <unistd.h>
19#include <errno.h>]],
20 [if (dup2 (1, 1) == 0)
21 return 1;
22 close (0);
23 if (dup2 (0, 0) != -1)
24 return 2;
25 /* Many gnulib modules require POSIX conformance of EBADF. */
26 if (dup2 (1, 1000000) == -1 && errno != EBADF)
27 return 3;
28 return 0;
29 ])
30 ],
31 [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no],
32 [case "$host_os" in
33 mingw*) # on this platform, dup2 always returns 0 for success
34 gl_cv_func_dup2_works=no;;
35 cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0
36 gl_cv_func_dup2_works=no;;
37 linux*) # On linux between 2008-07-27 and 2009-05-11, dup2 of a
38 # closed fd may yield -EBADF instead of -1 / errno=EBADF.
39 gl_cv_func_dup2_works=no;;
40 freebsd*) # on FreeBSD 6.1, dup2(1,1000000) gives EMFILE, not EBADF.
41 gl_cv_func_dup2_works=no;;
42 *) gl_cv_func_dup2_works=yes;;
43 esac])
44 ])
45 if test "$gl_cv_func_dup2_works" = no; then
46 gl_REPLACE_DUP2
47 fi
48 fi
49])
50
51AC_DEFUN([gl_REPLACE_DUP2],
52[
53 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
54 if test $ac_cv_func_dup2 = yes; then
55 REPLACE_DUP2=1
56 fi
57 AC_LIBOBJ([dup2])
58])
diff --git a/gl/m4/eealloc.m4 b/gl/m4/eealloc.m4
index 63dd920..c640ec1 100644
--- a/gl/m4/eealloc.m4
+++ b/gl/m4/eealloc.m4
@@ -1,5 +1,5 @@
1# eealloc.m4 serial 2 1# eealloc.m4 serial 3
2dnl Copyright (C) 2003, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -8,7 +8,6 @@ AC_DEFUN([gl_EEALLOC],
8[ 8[
9 AC_REQUIRE([gl_EEMALLOC]) 9 AC_REQUIRE([gl_EEMALLOC])
10 AC_REQUIRE([gl_EEREALLOC]) 10 AC_REQUIRE([gl_EEREALLOC])
11 AC_REQUIRE([AC_C_INLINE])
12]) 11])
13 12
14AC_DEFUN([gl_EEMALLOC], 13AC_DEFUN([gl_EEMALLOC],
diff --git a/gl/m4/environ.m4 b/gl/m4/environ.m4
index 4c6849a..593a33e 100644
--- a/gl/m4/environ.m4
+++ b/gl/m4/environ.m4
@@ -1,5 +1,5 @@
1# environ.m4 serial 4 1# environ.m4 serial 6
2dnl Copyright (C) 2001-2004, 2006-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2004, 2006-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -9,7 +9,16 @@ AC_DEFUN_ONCE([gl_ENVIRON],
9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) 9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
10 dnl Persuade glibc <unistd.h> to declare environ. 10 dnl Persuade glibc <unistd.h> to declare environ.
11 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 11 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
12 gt_CHECK_VAR_DECL([#include <unistd.h>], environ) 12
13 AC_CHECK_HEADERS_ONCE([unistd.h])
14 gt_CHECK_VAR_DECL(
15 [#if HAVE_UNISTD_H
16 #include <unistd.h>
17 #endif
18 /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */
19 #include <stdlib.h>
20 ],
21 [environ])
13 if test $gt_cv_var_environ_declaration != yes; then 22 if test $gt_cv_var_environ_declaration != yes; then
14 HAVE_DECL_ENVIRON=0 23 HAVE_DECL_ENVIRON=0
15 fi 24 fi
@@ -22,11 +31,13 @@ AC_DEFUN([gt_CHECK_VAR_DECL],
22 define([gt_cv_var], [gt_cv_var_]$2[_declaration]) 31 define([gt_cv_var], [gt_cv_var_]$2[_declaration])
23 AC_MSG_CHECKING([if $2 is properly declared]) 32 AC_MSG_CHECKING([if $2 is properly declared])
24 AC_CACHE_VAL([gt_cv_var], [ 33 AC_CACHE_VAL([gt_cv_var], [
25 AC_TRY_COMPILE([$1 34 AC_COMPILE_IFELSE(
26 extern struct { int foo; } $2;], 35 [AC_LANG_PROGRAM(
27 [$2.foo = 1;], 36 [[$1
28 gt_cv_var=no, 37 extern struct { int foo; } $2;]],
29 gt_cv_var=yes)]) 38 [[$2.foo = 1;]])],
39 [gt_cv_var=no],
40 [gt_cv_var=yes])])
30 AC_MSG_RESULT([$gt_cv_var]) 41 AC_MSG_RESULT([$gt_cv_var])
31 if test $gt_cv_var = yes; then 42 if test $gt_cv_var = yes; then
32 AC_DEFINE([HAVE_]m4_translit($2, [a-z], [A-Z])[_DECL], 1, 43 AC_DEFINE([HAVE_]m4_translit($2, [a-z], [A-Z])[_DECL], 1,
diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4
index d02a039..c813ea5 100644
--- a/gl/m4/errno_h.m4
+++ b/gl/m4/errno_h.m4
@@ -1,5 +1,5 @@
1# errno_h.m4 serial 6 1# errno_h.m4 serial 12
2dnl Copyright (C) 2004, 2006, 2008, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2004, 2006, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -10,6 +10,9 @@ AC_DEFUN_ONCE([gl_HEADER_ERRNO_H],
10 AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ 10 AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
11 AC_EGREP_CPP([booboo],[ 11 AC_EGREP_CPP([booboo],[
12#include <errno.h> 12#include <errno.h>
13#if !defined ETXTBSY
14booboo
15#endif
13#if !defined ENOMSG 16#if !defined ENOMSG
14booboo 17booboo
15#endif 18#endif
@@ -34,12 +37,30 @@ booboo
34#if !defined ENOTSUP 37#if !defined ENOTSUP
35booboo 38booboo
36#endif 39#endif
40#if !defined ENETRESET
41booboo
42#endif
43#if !defined ECONNABORTED
44booboo
45#endif
37#if !defined ESTALE 46#if !defined ESTALE
38booboo 47booboo
39#endif 48#endif
49#if !defined EDQUOT
50booboo
51#endif
40#if !defined ECANCELED 52#if !defined ECANCELED
41booboo 53booboo
42#endif 54#endif
55#if !defined EOWNERDEAD
56booboo
57#endif
58#if !defined ENOTRECOVERABLE
59booboo
60#endif
61#if !defined EILSEQ
62booboo
63#endif
43 ], 64 ],
44 [gl_cv_header_errno_h_complete=no], 65 [gl_cv_header_errno_h_complete=no],
45 [gl_cv_header_errno_h_complete=yes]) 66 [gl_cv_header_errno_h_complete=yes])
@@ -47,10 +68,11 @@ booboo
47 if test $gl_cv_header_errno_h_complete = yes; then 68 if test $gl_cv_header_errno_h_complete = yes; then
48 ERRNO_H='' 69 ERRNO_H=''
49 else 70 else
50 gl_CHECK_NEXT_HEADERS([errno.h]) 71 gl_NEXT_HEADERS([errno.h])
51 ERRNO_H='errno.h' 72 ERRNO_H='errno.h'
52 fi 73 fi
53 AC_SUBST([ERRNO_H]) 74 AC_SUBST([ERRNO_H])
75 AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"])
54 gl_REPLACE_ERRNO_VALUE([EMULTIHOP]) 76 gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
55 gl_REPLACE_ERRNO_VALUE([ENOLINK]) 77 gl_REPLACE_ERRNO_VALUE([ENOLINK])
56 gl_REPLACE_ERRNO_VALUE([EOVERFLOW]) 78 gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
diff --git a/gl/m4/error.m4 b/gl/m4/error.m4
index 9f1307a..29e6fdc 100644
--- a/gl/m4/error.m4
+++ b/gl/m4/error.m4
@@ -1,6 +1,6 @@
1#serial 12 1#serial 14
2 2
3# Copyright (C) 1996-1998, 2001-2004, 2009-2010 Free Software Foundation, Inc. 3# Copyright (C) 1996-1998, 2001-2004, 2009-2013 Free Software Foundation, Inc.
4# 4#
5# This file is free software; the Free Software Foundation 5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it, 6# gives unlimited permission to copy and/or distribute it,
@@ -8,15 +8,20 @@
8 8
9AC_DEFUN([gl_ERROR], 9AC_DEFUN([gl_ERROR],
10[ 10[
11 AC_FUNC_ERROR_AT_LINE 11 dnl We don't use AC_FUNC_ERROR_AT_LINE any more, because it is no longer
12 dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]). 12 dnl maintained in Autoconf and because it invokes AC_LIBOBJ.
13 gl_PREREQ_ERROR 13 AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line],
14 [AC_LINK_IFELSE(
15 [AC_LANG_PROGRAM(
16 [[#include <error.h>]],
17 [[error_at_line (0, 0, "", 0, "an error occurred");]])],
18 [ac_cv_lib_error_at_line=yes],
19 [ac_cv_lib_error_at_line=no])])
14]) 20])
15 21
16# Prerequisites of lib/error.c. 22# Prerequisites of lib/error.c.
17AC_DEFUN([gl_PREREQ_ERROR], 23AC_DEFUN([gl_PREREQ_ERROR],
18[ 24[
19 AC_REQUIRE([AC_FUNC_STRERROR_R]) 25 AC_REQUIRE([AC_FUNC_STRERROR_R])
20 AC_REQUIRE([AC_C_INLINE])
21 : 26 :
22]) 27])
diff --git a/gl/m4/exponentd.m4 b/gl/m4/exponentd.m4
new file mode 100644
index 0000000..09df468
--- /dev/null
+++ b/gl/m4/exponentd.m4
@@ -0,0 +1,116 @@
1# exponentd.m4 serial 3
2dnl Copyright (C) 2007-2008, 2010-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6AC_DEFUN([gl_DOUBLE_EXPONENT_LOCATION],
7[
8 AC_CACHE_CHECK([where to find the exponent in a 'double'],
9 [gl_cv_cc_double_expbit0],
10 [
11 AC_RUN_IFELSE(
12 [AC_LANG_SOURCE([[
13#include <float.h>
14#include <stddef.h>
15#include <stdio.h>
16#include <string.h>
17#define NWORDS \
18 ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
19typedef union { double value; unsigned int word[NWORDS]; } memory_double;
20static unsigned int ored_words[NWORDS];
21static unsigned int anded_words[NWORDS];
22static void add_to_ored_words (double x)
23{
24 memory_double m;
25 size_t i;
26 /* Clear it first, in case sizeof (double) < sizeof (memory_double). */
27 memset (&m, 0, sizeof (memory_double));
28 m.value = x;
29 for (i = 0; i < NWORDS; i++)
30 {
31 ored_words[i] |= m.word[i];
32 anded_words[i] &= m.word[i];
33 }
34}
35int main ()
36{
37 size_t j;
38 FILE *fp = fopen ("conftest.out", "w");
39 if (fp == NULL)
40 return 1;
41 for (j = 0; j < NWORDS; j++)
42 anded_words[j] = ~ (unsigned int) 0;
43 add_to_ored_words (0.25);
44 add_to_ored_words (0.5);
45 add_to_ored_words (1.0);
46 add_to_ored_words (2.0);
47 add_to_ored_words (4.0);
48 /* Remove bits that are common (e.g. if representation of the first mantissa
49 bit is explicit). */
50 for (j = 0; j < NWORDS; j++)
51 ored_words[j] &= ~anded_words[j];
52 /* Now find the nonzero word. */
53 for (j = 0; j < NWORDS; j++)
54 if (ored_words[j] != 0)
55 break;
56 if (j < NWORDS)
57 {
58 size_t i;
59 for (i = j + 1; i < NWORDS; i++)
60 if (ored_words[i] != 0)
61 {
62 fprintf (fp, "unknown");
63 return (fclose (fp) != 0);
64 }
65 for (i = 0; ; i++)
66 if ((ored_words[j] >> i) & 1)
67 {
68 fprintf (fp, "word %d bit %d", (int) j, (int) i);
69 return (fclose (fp) != 0);
70 }
71 }
72 fprintf (fp, "unknown");
73 return (fclose (fp) != 0);
74}
75 ]])],
76 [gl_cv_cc_double_expbit0=`cat conftest.out`],
77 [gl_cv_cc_double_expbit0="unknown"],
78 [
79 dnl On ARM, there are two 'double' floating-point formats, used by
80 dnl different sets of instructions: The older FPA instructions assume
81 dnl that they are stored in big-endian word order, while the words
82 dnl (like integer types) are stored in little-endian byte order.
83 dnl The newer VFP instructions assume little-endian order
84 dnl consistently.
85 AC_EGREP_CPP([mixed_endianness], [
86#if defined arm || defined __arm || defined __arm__
87 mixed_endianness
88#endif
89 ],
90 [gl_cv_cc_double_expbit0="unknown"],
91 [
92 pushdef([AC_MSG_CHECKING],[:])dnl
93 pushdef([AC_MSG_RESULT],[:])dnl
94 pushdef([AC_MSG_RESULT_UNQUOTED],[:])dnl
95 AC_C_BIGENDIAN(
96 [gl_cv_cc_double_expbit0="word 0 bit 20"],
97 [gl_cv_cc_double_expbit0="word 1 bit 20"],
98 [gl_cv_cc_double_expbit0="unknown"])
99 popdef([AC_MSG_RESULT_UNQUOTED])dnl
100 popdef([AC_MSG_RESULT])dnl
101 popdef([AC_MSG_CHECKING])dnl
102 ])
103 ])
104 rm -f conftest.out
105 ])
106 case "$gl_cv_cc_double_expbit0" in
107 word*bit*)
108 word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'`
109 bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'`
110 AC_DEFINE_UNQUOTED([DBL_EXPBIT0_WORD], [$word],
111 [Define as the word index where to find the exponent of 'double'.])
112 AC_DEFINE_UNQUOTED([DBL_EXPBIT0_BIT], [$bit],
113 [Define as the bit index in the word where to find bit 0 of the exponent of 'double'.])
114 ;;
115 esac
116])
diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4
index 7d9458a..e30f122 100644
--- a/gl/m4/extensions.m4
+++ b/gl/m4/extensions.m4
@@ -1,14 +1,14 @@
1# serial 9 -*- Autoconf -*- 1# serial 13 -*- Autoconf -*-
2# Enable extensions on systems that normally disable them. 2# Enable extensions on systems that normally disable them.
3 3
4# Copyright (C) 2003, 2006-2010 Free Software Foundation, Inc. 4# Copyright (C) 2003, 2006-2013 Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation 5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it, 6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved. 7# with or without modifications, as long as this notice is preserved.
8 8
9# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS 9# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git
10# Autoconf. Perhaps we can remove this once we can assume Autoconf 10# Autoconf. Perhaps we can remove this once we can assume Autoconf
11# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly 11# 2.70 or later everywhere, but since Autoconf mutates rapidly
12# enough in this area it's likely we'll need to redefine 12# enough in this area it's likely we'll need to redefine
13# AC_USE_SYSTEM_EXTENSIONS for quite some time. 13# AC_USE_SYSTEM_EXTENSIONS for quite some time.
14 14
@@ -30,6 +30,7 @@
30# ------------------------ 30# ------------------------
31# Enable extensions on systems that normally disable them, 31# Enable extensions on systems that normally disable them,
32# typically due to standards-conformance issues. 32# typically due to standards-conformance issues.
33#
33# Remember that #undef in AH_VERBATIM gets replaced with #define by 34# Remember that #undef in AH_VERBATIM gets replaced with #define by
34# AC_DEFINE. The goal here is to define all known feature-enabling 35# AC_DEFINE. The goal here is to define all known feature-enabling
35# macros, then, if reports of conflicts are made, disable macros that 36# macros, then, if reports of conflicts are made, disable macros that
@@ -38,35 +39,31 @@ AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
38[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl 39[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
39AC_BEFORE([$0], [AC_RUN_IFELSE])dnl 40AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
40 41
41 AC_REQUIRE([AC_CANONICAL_HOST])
42
43 AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) 42 AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
44 if test "$MINIX" = yes; then 43 if test "$MINIX" = yes; then
45 AC_DEFINE([_POSIX_SOURCE], [1], 44 AC_DEFINE([_POSIX_SOURCE], [1],
46 [Define to 1 if you need to in order for `stat' and other 45 [Define to 1 if you need to in order for 'stat' and other
47 things to work.]) 46 things to work.])
48 AC_DEFINE([_POSIX_1_SOURCE], [2], 47 AC_DEFINE([_POSIX_1_SOURCE], [2],
49 [Define to 2 if the system does not provide POSIX.1 features 48 [Define to 2 if the system does not provide POSIX.1 features
50 except with this defined.]) 49 except with this defined.])
51 AC_DEFINE([_MINIX], [1], 50 AC_DEFINE([_MINIX], [1],
52 [Define to 1 if on MINIX.]) 51 [Define to 1 if on MINIX.])
52 AC_DEFINE([_NETBSD_SOURCE], [1],
53 [Define to 1 to make NetBSD features available. MINIX 3 needs this.])
53 fi 54 fi
54 55
55 dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500, 56dnl Use a different key than __EXTENSIONS__, as that name broke existing
56 dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already 57dnl configure.ac when using autoheader 2.62.
57 dnl provided. 58 AH_VERBATIM([USE_SYSTEM_EXTENSIONS],
58 case "$host_os" in
59 hpux*)
60 AC_DEFINE([_XOPEN_SOURCE], [500],
61 [Define to 500 only on HP-UX.])
62 ;;
63 esac
64
65 AH_VERBATIM([__EXTENSIONS__],
66[/* Enable extensions on AIX 3, Interix. */ 59[/* Enable extensions on AIX 3, Interix. */
67#ifndef _ALL_SOURCE 60#ifndef _ALL_SOURCE
68# undef _ALL_SOURCE 61# undef _ALL_SOURCE
69#endif 62#endif
63/* Enable general extensions on OS X. */
64#ifndef _DARWIN_C_SOURCE
65# undef _DARWIN_C_SOURCE
66#endif
70/* Enable GNU extensions on systems that have them. */ 67/* Enable GNU extensions on systems that have them. */
71#ifndef _GNU_SOURCE 68#ifndef _GNU_SOURCE
72# undef _GNU_SOURCE 69# undef _GNU_SOURCE
@@ -79,6 +76,12 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
79#ifndef _TANDEM_SOURCE 76#ifndef _TANDEM_SOURCE
80# undef _TANDEM_SOURCE 77# undef _TANDEM_SOURCE
81#endif 78#endif
79/* Enable X/Open extensions if necessary. HP-UX 11.11 defines
80 mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
81 whether compiling with -Ae or -D_HPUX_SOURCE=1. */
82#ifndef _XOPEN_SOURCE
83# undef _XOPEN_SOURCE
84#endif
82/* Enable general extensions on Solaris. */ 85/* Enable general extensions on Solaris. */
83#ifndef __EXTENSIONS__ 86#ifndef __EXTENSIONS__
84# undef __EXTENSIONS__ 87# undef __EXTENSIONS__
@@ -95,9 +98,26 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
95 test $ac_cv_safe_to_define___extensions__ = yes && 98 test $ac_cv_safe_to_define___extensions__ = yes &&
96 AC_DEFINE([__EXTENSIONS__]) 99 AC_DEFINE([__EXTENSIONS__])
97 AC_DEFINE([_ALL_SOURCE]) 100 AC_DEFINE([_ALL_SOURCE])
101 AC_DEFINE([_DARWIN_C_SOURCE])
98 AC_DEFINE([_GNU_SOURCE]) 102 AC_DEFINE([_GNU_SOURCE])
99 AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) 103 AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
100 AC_DEFINE([_TANDEM_SOURCE]) 104 AC_DEFINE([_TANDEM_SOURCE])
105 AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
106 [ac_cv_should_define__xopen_source],
107 [ac_cv_should_define__xopen_source=no
108 AC_COMPILE_IFELSE(
109 [AC_LANG_PROGRAM([[
110 #include <wchar.h>
111 mbstate_t x;]])],
112 [],
113 [AC_COMPILE_IFELSE(
114 [AC_LANG_PROGRAM([[
115 #define _XOPEN_SOURCE 500
116 #include <wchar.h>
117 mbstate_t x;]])],
118 [ac_cv_should_define__xopen_source=yes])])])
119 test $ac_cv_should_define__xopen_source = yes &&
120 AC_DEFINE([_XOPEN_SOURCE], [500])
101])# AC_USE_SYSTEM_EXTENSIONS 121])# AC_USE_SYSTEM_EXTENSIONS
102 122
103# gl_USE_SYSTEM_EXTENSIONS 123# gl_USE_SYSTEM_EXTENSIONS
diff --git a/gl/m4/extern-inline.m4 b/gl/m4/extern-inline.m4
new file mode 100644
index 0000000..c4c5e7f
--- /dev/null
+++ b/gl/m4/extern-inline.m4
@@ -0,0 +1,70 @@
1dnl 'extern inline' a la ISO C99.
2
3dnl Copyright 2012-2013 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8AC_DEFUN([gl_EXTERN_INLINE],
9[
10 AH_VERBATIM([extern_inline],
11[/* Please see the Gnulib manual for how to use these macros.
12
13 Suppress extern inline with HP-UX cc, as it appears to be broken; see
14 <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>.
15
16 Suppress extern inline with Sun C in standards-conformance mode, as it
17 mishandles inline functions that call each other. E.g., for 'inline void f
18 (void) { } inline void g (void) { f (); }', c99 incorrectly complains
19 'reference to static identifier "f" in extern inline function'.
20 This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16.
21
22 Suppress the use of extern inline on Apple's platforms, as Libc at least
23 through Libc-825.26 (2013-04-09) is incompatible with it; see, e.g.,
24 <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
25 Perhaps Apple will fix this some day. */
26#if ((__GNUC__ \
27 ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
28 : (199901L <= __STDC_VERSION__ \
29 && !defined __HP_cc \
30 && !(defined __SUNPRO_C && __STDC__))) \
31 && !defined __APPLE__)
32# define _GL_INLINE inline
33# define _GL_EXTERN_INLINE extern inline
34#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
35 && !defined __APPLE__)
36# if __GNUC_GNU_INLINE__
37 /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
38# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
39# else
40# define _GL_INLINE extern inline
41# endif
42# define _GL_EXTERN_INLINE extern
43#else
44# define _GL_INLINE static _GL_UNUSED
45# define _GL_EXTERN_INLINE static _GL_UNUSED
46#endif
47
48#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
49# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
50# define _GL_INLINE_HEADER_CONST_PRAGMA
51# else
52# define _GL_INLINE_HEADER_CONST_PRAGMA \
53 _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
54# endif
55 /* Suppress GCC's bogus "no previous prototype for 'FOO'"
56 and "no previous declaration for 'FOO'" diagnostics,
57 when FOO is an inline function in the header; see
58 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. */
59# define _GL_INLINE_HEADER_BEGIN \
60 _Pragma ("GCC diagnostic push") \
61 _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
62 _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
63 _GL_INLINE_HEADER_CONST_PRAGMA
64# define _GL_INLINE_HEADER_END \
65 _Pragma ("GCC diagnostic pop")
66#else
67# define _GL_INLINE_HEADER_BEGIN
68# define _GL_INLINE_HEADER_END
69#endif])
70])
diff --git a/gl/m4/fcntl-o.m4 b/gl/m4/fcntl-o.m4
index d416a61..87cc4bd 100644
--- a/gl/m4/fcntl-o.m4
+++ b/gl/m4/fcntl-o.m4
@@ -1,5 +1,5 @@
1# fcntl-o.m4 serial 1 1# fcntl-o.m4 serial 4
2dnl Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -12,13 +12,26 @@ dnl Written by Paul Eggert.
12AC_DEFUN([gl_FCNTL_O_FLAGS], 12AC_DEFUN([gl_FCNTL_O_FLAGS],
13[ 13[
14 dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW. 14 dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW.
15 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) 15 dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes
16 dnl AC_GNU_SOURCE.
17 m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],
18 [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])],
19 [AC_REQUIRE([AC_GNU_SOURCE])])
20
21 AC_CHECK_HEADERS_ONCE([unistd.h])
22 AC_CHECK_FUNCS_ONCE([symlink])
16 AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], 23 AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h],
17 [AC_RUN_IFELSE( 24 [AC_RUN_IFELSE(
18 [AC_LANG_PROGRAM( 25 [AC_LANG_PROGRAM(
19 [[#include <sys/types.h> 26 [[#include <sys/types.h>
20 #include <sys/stat.h> 27 #include <sys/stat.h>
21 #include <unistd.h> 28 #if HAVE_UNISTD_H
29 # include <unistd.h>
30 #else /* on Windows with MSVC */
31 # include <io.h>
32 # include <stdlib.h>
33 # defined sleep(n) _sleep ((n) * 1000)
34 #endif
22 #include <fcntl.h> 35 #include <fcntl.h>
23 #ifndef O_NOATIME 36 #ifndef O_NOATIME
24 #define O_NOATIME 0 37 #define O_NOATIME 0
@@ -33,34 +46,74 @@ AC_DEFUN([gl_FCNTL_O_FLAGS],
33 }; 46 };
34 ]], 47 ]],
35 [[ 48 [[
36 int status = !constants; 49 int result = !constants;
50 #if HAVE_SYMLINK
37 { 51 {
38 static char const sym[] = "conftest.sym"; 52 static char const sym[] = "conftest.sym";
39 if (symlink (".", sym) != 0 53 if (symlink ("/dev/null", sym) != 0)
40 || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0) 54 result |= 2;
41 status |= 32; 55 else
56 {
57 int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0);
58 if (fd >= 0)
59 {
60 close (fd);
61 result |= 4;
62 }
63 }
64 if (unlink (sym) != 0 || symlink (".", sym) != 0)
65 result |= 2;
66 else
67 {
68 int fd = open (sym, O_RDONLY | O_NOFOLLOW);
69 if (fd >= 0)
70 {
71 close (fd);
72 result |= 4;
73 }
74 }
42 unlink (sym); 75 unlink (sym);
43 } 76 }
77 #endif
44 { 78 {
45 static char const file[] = "confdefs.h"; 79 static char const file[] = "confdefs.h";
46 int fd = open (file, O_RDONLY | O_NOATIME); 80 int fd = open (file, O_RDONLY | O_NOATIME);
47 char c; 81 if (fd < 0)
48 struct stat st0, st1; 82 result |= 8;
49 if (fd < 0 83 else
50 || fstat (fd, &st0) != 0 84 {
51 || sleep (1) != 0 85 struct stat st0;
52 || read (fd, &c, 1) != 1 86 if (fstat (fd, &st0) != 0)
53 || close (fd) != 0 87 result |= 16;
54 || stat (file, &st1) != 0 88 else
55 || st0.st_atime != st1.st_atime) 89 {
56 status |= 64; 90 char c;
91 sleep (1);
92 if (read (fd, &c, 1) != 1)
93 result |= 24;
94 else
95 {
96 if (close (fd) != 0)
97 result |= 32;
98 else
99 {
100 struct stat st1;
101 if (stat (file, &st1) != 0)
102 result |= 40;
103 else
104 if (st0.st_atime != st1.st_atime)
105 result |= 64;
106 }
107 }
108 }
109 }
57 } 110 }
58 return status;]])], 111 return result;]])],
59 [gl_cv_header_working_fcntl_h=yes], 112 [gl_cv_header_working_fcntl_h=yes],
60 [case $? in #( 113 [case $? in #(
61 32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( 114 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #(
62 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( 115 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #(
63 96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( 116 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #(
64 *) gl_cv_header_working_fcntl_h='no';; 117 *) gl_cv_header_working_fcntl_h='no';;
65 esac], 118 esac],
66 [gl_cv_header_working_fcntl_h=cross-compiling])]) 119 [gl_cv_header_working_fcntl_h=cross-compiling])])
diff --git a/gl/m4/fcntl-safer.m4 b/gl/m4/fcntl-safer.m4
deleted file mode 100644
index 1a739b0..0000000
--- a/gl/m4/fcntl-safer.m4
+++ /dev/null
@@ -1,19 +0,0 @@
1#serial 7
2dnl Copyright (C) 2005-2007, 2009-2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FCNTL_SAFER],
8[
9 AC_LIBOBJ([open-safer])
10 AC_LIBOBJ([creat-safer])
11 # Prerequisites of lib/open-safer.c.
12 AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])
13])
14
15AC_DEFUN([gl_OPENAT_SAFER],
16[
17 AC_REQUIRE([gl_FCNTL_SAFER])
18 AC_LIBOBJ([openat-safer])
19])
diff --git a/gl/m4/fcntl.m4 b/gl/m4/fcntl.m4
deleted file mode 100644
index fcb5f44..0000000
--- a/gl/m4/fcntl.m4
+++ /dev/null
@@ -1,83 +0,0 @@
1# fcntl.m4 serial 3
2dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7# For now, this module ensures that fcntl()
8# - supports F_DUPFD correctly
9# - supports or emulates F_DUPFD_CLOEXEC
10# - supports F_GETFD
11# Still to be ported to mingw:
12# - F_SETFD
13# - F_GETFL, F_SETFL
14# - F_GETOWN, F_SETOWN
15# - F_GETLK, F_SETLK, F_SETLKW
16AC_DEFUN([gl_FUNC_FCNTL],
17[
18 dnl Persuade glibc to expose F_DUPFD_CLOEXEC.
19 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
20 AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
21 AC_REQUIRE([AC_CANONICAL_HOST])
22 AC_CHECK_FUNCS_ONCE([fcntl])
23 if test $ac_cv_func_fcntl = no; then
24 gl_REPLACE_FCNTL
25 else
26 dnl cygwin 1.5.x F_DUPFD has wrong errno, and allows negative target
27 AC_CACHE_CHECK([whether fcntl handles F_DUPFD correctly],
28 [gl_cv_func_fcntl_f_dupfd_works],
29 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
30#include <fcntl.h>
31]], [[return fcntl (0, F_DUPFD, -1) != -1;
32 ]])],
33 [gl_cv_func_fcntl_f_dupfd_works=yes],
34 [gl_cv_func_fcntl_f_dupfd_works=no],
35 [# Guess that it works on glibc systems
36 case $host_os in #((
37 *-gnu*) gl_cv_func_fcntl_f_dupfd_works="guessing yes";;
38 *) gl_cv_func_fcntl_f_dupfd_works="guessing no";;
39 esac])])
40 case $gl_cv_func_fcntl_f_dupfd_works in
41 *yes) ;;
42 *) gl_REPLACE_FCNTL
43 AC_DEFINE([FCNTL_DUPFD_BUGGY], [1], [Define this to 1 if F_DUPFD
44 behavior does not match POSIX]) ;;
45 esac
46
47 dnl Many systems lack F_DUPFD_CLOEXEC
48 AC_CACHE_CHECK([whether fcntl understands F_DUPFD_CLOEXEC],
49 [gl_cv_func_fcntl_f_dupfd_cloexec],
50 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
51#include <fcntl.h>
52#ifndef F_DUPFD_CLOEXEC
53choke me
54#endif
55 ]])],
56 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
57#ifdef __linux__
58/* The Linux kernel only added F_DUPFD_CLOEXEC in 2.6.24, so we always replace
59 it to support the semantics on older kernels that failed with EINVAL. */
60choke me
61#endif
62 ]])],
63 [gl_cv_func_fcntl_f_dupfd_cloexec=yes],
64 [gl_cv_func_fcntl_f_dupfd_cloexec="needs runtime check"])],
65 [gl_cv_func_fcntl_f_dupfd_cloexec=no])])
66 if test "$gl_cv_func_fcntl_f_dupfd_cloexec" != yes; then
67 gl_REPLACE_FCNTL
68 dnl No witness macro needed for this bug.
69 fi
70 fi
71])
72
73AC_DEFUN([gl_REPLACE_FCNTL],
74[
75 AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
76 AC_CHECK_FUNCS_ONCE([fcntl])
77 if test $ac_cv_func_fcntl = no; then
78 HAVE_FCNTL=0
79 else
80 REPLACE_FCNTL=1
81 fi
82 AC_LIBOBJ([fcntl])
83])
diff --git a/gl/m4/fcntl_h.m4 b/gl/m4/fcntl_h.m4
deleted file mode 100644
index e41915c..0000000
--- a/gl/m4/fcntl_h.m4
+++ /dev/null
@@ -1,43 +0,0 @@
1# serial 12
2# Configure fcntl.h.
3dnl Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl Written by Paul Eggert.
9
10AC_DEFUN([gl_FCNTL_H],
11[
12 AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
13 AC_REQUIRE([gl_FCNTL_O_FLAGS])
14 gl_CHECK_NEXT_HEADERS([fcntl.h])
15
16 dnl Check for declarations of anything we want to poison if the
17 dnl corresponding gnulib module is not in use, if it is not common
18 dnl enough to be declared everywhere.
19 gl_WARN_ON_USE_PREPARE([[#include <fcntl.h>
20 ]], [fcntl openat])
21])
22
23AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
24[
25 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
26 AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
27 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
28 dnl Define it also as a C macro, for the benefit of the unit tests.
29 gl_MODULE_INDICATOR_FOR_TESTS([$1])
30])
31
32AC_DEFUN([gl_FCNTL_H_DEFAULTS],
33[
34 GNULIB_FCNTL=0; AC_SUBST([GNULIB_FCNTL])
35 GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN])
36 GNULIB_OPENAT=0; AC_SUBST([GNULIB_OPENAT])
37 dnl Assume proper GNU behavior unless another module says otherwise.
38 HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL])
39 HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT])
40 REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL])
41 REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN])
42 REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT])
43])
diff --git a/gl/m4/float_h.m4 b/gl/m4/float_h.m4
index a74a0d9..397f2d1 100644
--- a/gl/m4/float_h.m4
+++ b/gl/m4/float_h.m4
@@ -1,5 +1,5 @@
1# float_h.m4 serial 3 1# float_h.m4 serial 9
2dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -9,11 +9,90 @@ AC_DEFUN([gl_FLOAT_H],
9 AC_REQUIRE([AC_PROG_CC]) 9 AC_REQUIRE([AC_PROG_CC])
10 AC_REQUIRE([AC_CANONICAL_HOST]) 10 AC_REQUIRE([AC_CANONICAL_HOST])
11 FLOAT_H= 11 FLOAT_H=
12 REPLACE_FLOAT_LDBL=0
12 case "$host_os" in 13 case "$host_os" in
13 beos* | openbsd*) 14 aix* | beos* | openbsd* | mirbsd* | irix*)
14 FLOAT_H=float.h 15 FLOAT_H=float.h
15 gl_CHECK_NEXT_HEADERS([float.h]) 16 ;;
17 freebsd*)
18 case "$host_cpu" in
19changequote(,)dnl
20 i[34567]86 )
21changequote([,])dnl
22 FLOAT_H=float.h
23 ;;
24 x86_64 )
25 # On x86_64 systems, the C compiler may still be generating
26 # 32-bit code.
27 AC_EGREP_CPP([yes],
28 [#if defined __LP64__ || defined __x86_64__ || defined __amd64__
29 yes
30 #endif],
31 [],
32 [FLOAT_H=float.h])
33 ;;
34 esac
35 ;;
36 linux*)
37 case "$host_cpu" in
38 powerpc*)
39 FLOAT_H=float.h
40 ;;
41 esac
42 ;;
43 esac
44 case "$host_os" in
45 aix* | freebsd* | linux*)
46 if test -n "$FLOAT_H"; then
47 REPLACE_FLOAT_LDBL=1
48 fi
16 ;; 49 ;;
17 esac 50 esac
51
52 dnl Test against glibc-2.7 Linux/SPARC64 bug.
53 REPLACE_ITOLD=0
54 AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works],
55 [gl_cv_func_itold_works],
56 [
57 AC_RUN_IFELSE(
58 [AC_LANG_SOURCE([[
59int i = -1;
60volatile long double ld;
61int main ()
62{
63 ld += i * 1.0L;
64 if (ld > 0)
65 return 1;
66 return 0;
67}]])],
68 [gl_cv_func_itold_works=yes],
69 [gl_cv_func_itold_works=no],
70 [case "$host" in
71 sparc*-*-linux*)
72 AC_EGREP_CPP([yes],
73 [#if defined __LP64__ || defined __arch64__
74 yes
75 #endif],
76 [gl_cv_func_itold_works="guessing no"],
77 [gl_cv_func_itold_works="guessing yes"])
78 ;;
79 *) gl_cv_func_itold_works="guessing yes" ;;
80 esac
81 ])
82 ])
83 case "$gl_cv_func_itold_works" in
84 *no)
85 REPLACE_ITOLD=1
86 dnl We add the workaround to <float.h> but also to <math.h>,
87 dnl to increase the chances that the fix function gets pulled in.
88 FLOAT_H=float.h
89 ;;
90 esac
91
92 if test -n "$FLOAT_H"; then
93 gl_NEXT_HEADERS([float.h])
94 fi
18 AC_SUBST([FLOAT_H]) 95 AC_SUBST([FLOAT_H])
96 AM_CONDITIONAL([GL_GENERATE_FLOAT_H], [test -n "$FLOAT_H"])
97 AC_SUBST([REPLACE_ITOLD])
19]) 98])
diff --git a/gl/m4/floorf.m4 b/gl/m4/floorf.m4
index fb17a5e..c892ff9 100644
--- a/gl/m4/floorf.m4
+++ b/gl/m4/floorf.m4
@@ -1,16 +1,17 @@
1# floorf.m4 serial 6 1# floorf.m4 serial 13
2dnl Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7AC_DEFUN([gl_FUNC_FLOORF], 7AC_DEFUN([gl_FUNC_FLOORF],
8[ 8[
9 m4_divert_text([DEFAULTS], [gl_floorf_required=plain])
9 AC_REQUIRE([gl_MATH_H_DEFAULTS]) 10 AC_REQUIRE([gl_MATH_H_DEFAULTS])
10 dnl Persuade glibc <math.h> to declare floorf(). 11 dnl Persuade glibc <math.h> to declare floorf().
11 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 12 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
12 dnl Test whether floorf() is declared. 13 dnl Test whether floorf() is declared.
13 AC_CHECK_DECLS([floorf], , , [#include <math.h>]) 14 AC_CHECK_DECLS([floorf], , , [[#include <math.h>]])
14 if test "$ac_cv_have_decl_floorf" = yes; then 15 if test "$ac_cv_have_decl_floorf" = yes; then
15 dnl Test whether floorf() can be used without libm. 16 dnl Test whether floorf() can be used without libm.
16 gl_FUNC_FLOORF_LIBS 17 gl_FUNC_FLOORF_LIBS
@@ -19,11 +20,54 @@ AC_DEFUN([gl_FUNC_FLOORF],
19 dnl libm.so, but not in the libm.so that the compiler uses. 20 dnl libm.so, but not in the libm.so that the compiler uses.
20 REPLACE_FLOORF=1 21 REPLACE_FLOORF=1
21 fi 22 fi
23 m4_ifdef([gl_FUNC_FLOORF_IEEE], [
24 if test $gl_floorf_required = ieee && test $REPLACE_FLOORF = 0; then
25 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
26 AC_CACHE_CHECK([whether floorf works according to ISO C 99 with IEC 60559],
27 [gl_cv_func_floorf_ieee],
28 [
29 save_LIBS="$LIBS"
30 LIBS="$LIBS $FLOORF_LIBM"
31 AC_RUN_IFELSE(
32 [AC_LANG_SOURCE([[
33#ifndef __NO_MATH_INLINES
34# define __NO_MATH_INLINES 1 /* for glibc */
35#endif
36#include <math.h>
37]gl_FLOAT_MINUS_ZERO_CODE[
38]gl_FLOAT_SIGNBIT_CODE[
39static float dummy (float f) { return 0; }
40int main (int argc, char *argv[])
41{
42 float (*my_floorf) (float) = argc ? floorf : dummy;
43 /* Test whether floorf (-0.0f) is -0.0f. */
44 if (signbitf (minus_zerof) && !signbitf (my_floorf (minus_zerof)))
45 return 1;
46 return 0;
47}
48 ]])],
49 [gl_cv_func_floorf_ieee=yes],
50 [gl_cv_func_floorf_ieee=no],
51 [case "$host_os" in
52 # Guess yes on glibc systems.
53 *-gnu*) gl_cv_func_floorf_ieee="guessing yes" ;;
54 # If we don't know, assume the worst.
55 *) gl_cv_func_floorf_ieee="guessing no" ;;
56 esac
57 ])
58 LIBS="$save_LIBS"
59 ])
60 case "$gl_cv_func_floorf_ieee" in
61 *yes) ;;
62 *) REPLACE_FLOORF=1 ;;
63 esac
64 fi
65 ])
22 else 66 else
23 HAVE_DECL_FLOORF=0 67 HAVE_DECL_FLOORF=0
24 fi 68 fi
25 if test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1; then 69 if test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1; then
26 AC_LIBOBJ([floorf]) 70 dnl No libraries are needed to link lib/floorf.c.
27 FLOORF_LIBM= 71 FLOORF_LIBM=
28 fi 72 fi
29 AC_SUBST([FLOORF_LIBM]) 73 AC_SUBST([FLOORF_LIBM])
@@ -35,24 +79,28 @@ AC_DEFUN([gl_FUNC_FLOORF_LIBS],
35[ 79[
36 gl_CACHE_VAL_SILENT([gl_cv_func_floorf_libm], [ 80 gl_CACHE_VAL_SILENT([gl_cv_func_floorf_libm], [
37 gl_cv_func_floorf_libm=? 81 gl_cv_func_floorf_libm=?
38 AC_TRY_LINK([ 82 AC_LINK_IFELSE(
39 #ifndef __NO_MATH_INLINES 83 [AC_LANG_PROGRAM(
40 # define __NO_MATH_INLINES 1 /* for glibc */ 84 [[#ifndef __NO_MATH_INLINES
41 #endif 85 # define __NO_MATH_INLINES 1 /* for glibc */
42 #include <math.h> 86 #endif
43 float x;], 87 #include <math.h>
44 [x = floorf(x);], 88 float (*funcptr) (float) = floorf;
89 float x;]],
90 [[x = funcptr(x) + floorf(x);]])],
45 [gl_cv_func_floorf_libm=]) 91 [gl_cv_func_floorf_libm=])
46 if test "$gl_cv_func_floorf_libm" = "?"; then 92 if test "$gl_cv_func_floorf_libm" = "?"; then
47 save_LIBS="$LIBS" 93 save_LIBS="$LIBS"
48 LIBS="$LIBS -lm" 94 LIBS="$LIBS -lm"
49 AC_TRY_LINK([ 95 AC_LINK_IFELSE(
50 #ifndef __NO_MATH_INLINES 96 [AC_LANG_PROGRAM(
51 # define __NO_MATH_INLINES 1 /* for glibc */ 97 [[#ifndef __NO_MATH_INLINES
52 #endif 98 # define __NO_MATH_INLINES 1 /* for glibc */
53 #include <math.h> 99 #endif
54 float x;], 100 #include <math.h>
55 [x = floorf(x);], 101 float (*funcptr) (float) = floorf;
102 float x;]],
103 [[x = funcptr(x) + floorf(x);]])],
56 [gl_cv_func_floorf_libm="-lm"]) 104 [gl_cv_func_floorf_libm="-lm"])
57 LIBS="$save_LIBS" 105 LIBS="$save_LIBS"
58 fi 106 fi
diff --git a/gl/m4/fstypename.m4 b/gl/m4/fstypename.m4
index 9e81efe..c72ecb8 100644
--- a/gl/m4/fstypename.m4
+++ b/gl/m4/fstypename.m4
@@ -6,7 +6,7 @@ dnl See if struct statfs has the f_fstypename member.
6dnl If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME. 6dnl If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME.
7dnl 7dnl
8 8
9# Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2010 Free Software 9# Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2013 Free Software
10# Foundation, Inc. 10# Foundation, Inc.
11# This file is free software; the Free Software Foundation 11# This file is free software; the Free Software Foundation
12# gives unlimited permission to copy and/or distribute it, 12# gives unlimited permission to copy and/or distribute it,
diff --git a/gl/m4/fsusage.m4 b/gl/m4/fsusage.m4
index 216b9dd..6277bfa 100644
--- a/gl/m4/fsusage.m4
+++ b/gl/m4/fsusage.m4
@@ -1,7 +1,7 @@
1# serial 25 1# serial 30
2# Obtaining file system usage information. 2# Obtaining file system usage information.
3 3
4# Copyright (C) 1997-1998, 2000-2001, 2003-2010 Free Software Foundation, Inc. 4# Copyright (C) 1997-1998, 2000-2001, 2003-2013 Free Software Foundation, Inc.
5# 5#
6# This file is free software; the Free Software Foundation 6# This file is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it, 7# gives unlimited permission to copy and/or distribute it,
@@ -19,10 +19,6 @@ AC_DEFUN([gl_FSUSAGE],
19 #include <sys/param.h> 19 #include <sys/param.h>
20 #endif]]) 20 #endif]])
21 gl_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no]) 21 gl_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no])
22 if test $gl_cv_fs_space = yes; then
23 AC_LIBOBJ([fsusage])
24 gl_PREREQ_FSUSAGE_EXTRA
25 fi
26]) 22])
27 23
28# Try to determine how a program can obtain file system usage information. 24# Try to determine how a program can obtain file system usage information.
@@ -33,6 +29,12 @@ AC_DEFUN([gl_FSUSAGE],
33 29
34AC_DEFUN([gl_FILE_SYSTEM_USAGE], 30AC_DEFUN([gl_FILE_SYSTEM_USAGE],
35[ 31[
32dnl Enable large-file support. This has the effect of changing the size
33dnl of field f_blocks in 'struct statvfs' from 32 bit to 64 bit on
34dnl glibc/Hurd, HP-UX 11, Solaris (32-bit mode). It also changes the size
35dnl of field f_blocks in 'struct statfs' from 32 bit to 64 bit on
36dnl Mac OS X >= 10.5 (32-bit mode).
37AC_REQUIRE([AC_SYS_LARGEFILE])
36 38
37AC_MSG_NOTICE([checking how to get file system space usage]) 39AC_MSG_NOTICE([checking how to get file system space usage])
38ac_fsusage_space=no 40ac_fsusage_space=no
@@ -40,36 +42,98 @@ ac_fsusage_space=no
40# Perform only the link test since it seems there are no variants of the 42# Perform only the link test since it seems there are no variants of the
41# statvfs function. This check is more than just AC_CHECK_FUNCS([statvfs]) 43# statvfs function. This check is more than just AC_CHECK_FUNCS([statvfs])
42# because that got a false positive on SCO OSR5. Adding the declaration 44# because that got a false positive on SCO OSR5. Adding the declaration
43# of a `struct statvfs' causes this test to fail (as it should) on such 45# of a 'struct statvfs' causes this test to fail (as it should) on such
44# systems. That system is reported to work fine with STAT_STATFS4 which 46# systems. That system is reported to work fine with STAT_STATFS4 which
45# is what it gets when this test fails. 47# is what it gets when this test fails.
46if test $ac_fsusage_space = no; then 48if test $ac_fsusage_space = no; then
47 # SVR4 49 # glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0,
50 # OpenBSD >= 4.4, AIX, HP-UX, IRIX, Solaris, Cygwin, Interix, BeOS.
48 AC_CACHE_CHECK([for statvfs function (SVR4)], [fu_cv_sys_stat_statvfs], 51 AC_CACHE_CHECK([for statvfs function (SVR4)], [fu_cv_sys_stat_statvfs],
49 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 52 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
50#if defined __GLIBC__ && defined __linux__
51Do not use statvfs on systems with GNU libc on Linux, because that function
52stats all preceding entries in /proc/mounts, and that makes df hang if even
53one of the corresponding file systems is hard-mounted, but not available.
54statvfs in GNU libc on Hurd, BeOS, Haiku operates differently: it only makes
55a system call.
56#endif
57
58#ifdef __osf__ 53#ifdef __osf__
59"Do not use Tru64's statvfs implementation" 54"Do not use Tru64's statvfs implementation"
60#endif 55#endif
61 56
62#include <sys/statvfs.h>]], 57#include <sys/statvfs.h>
63 [[struct statvfs fsd; statvfs (0, &fsd);]])], 58
59struct statvfs fsd;
60
61#if defined __APPLE__ && defined __MACH__
62#include <limits.h>
63/* On Mac OS X >= 10.5, f_blocks in 'struct statvfs' is a 32-bit quantity;
64 that commonly limits file systems to 4 TiB. Whereas f_blocks in
65 'struct statfs' is a 64-bit type, thanks to the large-file support
66 that was enabled above. In this case, don't use statvfs(); use statfs()
67 instead. */
68int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1];
69#endif
70]],
71 [[statvfs (0, &fsd);]])],
64 [fu_cv_sys_stat_statvfs=yes], 72 [fu_cv_sys_stat_statvfs=yes],
65 [fu_cv_sys_stat_statvfs=no])]) 73 [fu_cv_sys_stat_statvfs=no])])
66 if test $fu_cv_sys_stat_statvfs = yes; then 74 if test $fu_cv_sys_stat_statvfs = yes; then
67 ac_fsusage_space=yes 75 ac_fsusage_space=yes
68 AC_DEFINE([STAT_STATVFS], [1], 76 # AIX >= 5.2 has statvfs64 that has a wider f_blocks field than statvfs.
69 [ Define if there is a function named statvfs. (SVR4)]) 77 # glibc, HP-UX, IRIX, Solaris have statvfs64 as well, but on these systems
78 # statvfs with large-file support is already equivalent to statvfs64.
79 AC_CACHE_CHECK([whether to use statvfs64],
80 [fu_cv_sys_stat_statvfs64],
81 [AC_LINK_IFELSE(
82 [AC_LANG_PROGRAM(
83 [[#include <sys/types.h>
84 #include <sys/statvfs.h>
85 struct statvfs64 fsd;
86 int check_f_blocks_larger_in_statvfs64
87 [sizeof (((struct statvfs64 *) 0)->f_blocks)
88 > sizeof (((struct statvfs *) 0)->f_blocks)
89 ? 1 : -1];
90 ]],
91 [[statvfs64 (0, &fsd);]])],
92 [fu_cv_sys_stat_statvfs64=yes],
93 [fu_cv_sys_stat_statvfs64=no])
94 ])
95 if test $fu_cv_sys_stat_statvfs64 = yes; then
96 AC_DEFINE([STAT_STATVFS64], [1],
97 [ Define if statvfs64 should be preferred over statvfs.])
98 else
99 AC_DEFINE([STAT_STATVFS], [1],
100 [ Define if there is a function named statvfs. (SVR4)])
101 fi
70 fi 102 fi
71fi 103fi
72 104
105# Check for this unconditionally so we have a
106# good fallback on glibc/Linux > 2.6 < 2.6.36
107AC_MSG_CHECKING([for two-argument statfs with statfs.f_frsize member])
108AC_CACHE_VAL([fu_cv_sys_stat_statfs2_frsize],
109[AC_RUN_IFELSE([AC_LANG_SOURCE([[
110#ifdef HAVE_SYS_PARAM_H
111#include <sys/param.h>
112#endif
113#ifdef HAVE_SYS_MOUNT_H
114#include <sys/mount.h>
115#endif
116#ifdef HAVE_SYS_VFS_H
117#include <sys/vfs.h>
118#endif
119 int
120 main ()
121 {
122 struct statfs fsd;
123 fsd.f_frsize = 0;
124 return statfs (".", &fsd) != 0;
125 }]])],
126 [fu_cv_sys_stat_statfs2_frsize=yes],
127 [fu_cv_sys_stat_statfs2_frsize=no],
128 [fu_cv_sys_stat_statfs2_frsize=no])])
129AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_frsize])
130if test $fu_cv_sys_stat_statfs2_frsize = yes; then
131 ac_fsusage_space=yes
132 AC_DEFINE([STAT_STATFS2_FRSIZE], [1],
133[ Define if statfs takes 2 args and struct statfs has a field named f_frsize.
134 (glibc/Linux > 2.6)])
135fi
136
73if test $ac_fsusage_space = no; then 137if test $ac_fsusage_space = no; then
74 # DEC Alpha running OSF/1 138 # DEC Alpha running OSF/1
75 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)]) 139 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
@@ -97,8 +161,13 @@ if test $ac_fsusage_space = no; then
97fi 161fi
98 162
99if test $ac_fsusage_space = no; then 163if test $ac_fsusage_space = no; then
100# AIX 164 # glibc/Linux, Mac OS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4.
101 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl 165 # (glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0,
166 # OpenBSD >= 4.4, AIX, HP-UX, OSF/1, Cygwin already handled above.)
167 # (On IRIX you need to include <sys/statfs.h>, not only <sys/mount.h> and
168 # <sys/vfs.h>.)
169 # (On Solaris, statfs has 4 arguments.)
170 AC_MSG_CHECKING([for two-argument statfs with statfs.f_bsize dnl
102member (AIX, 4.3BSD)]) 171member (AIX, 4.3BSD)])
103 AC_CACHE_VAL([fu_cv_sys_stat_statfs2_bsize], 172 AC_CACHE_VAL([fu_cv_sys_stat_statfs2_bsize],
104 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ 173 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
@@ -131,7 +200,8 @@ member (AIX, 4.3BSD)])
131fi 200fi
132 201
133if test $ac_fsusage_space = no; then 202if test $ac_fsusage_space = no; then
134# SVR3 203 # SVR3
204 # (Solaris already handled above.)
135 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)]) 205 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
136 AC_CACHE_VAL([fu_cv_sys_stat_statfs4], 206 AC_CACHE_VAL([fu_cv_sys_stat_statfs4],
137 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ 207 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
@@ -150,13 +220,17 @@ if test $ac_fsusage_space = no; then
150 if test $fu_cv_sys_stat_statfs4 = yes; then 220 if test $fu_cv_sys_stat_statfs4 = yes; then
151 ac_fsusage_space=yes 221 ac_fsusage_space=yes
152 AC_DEFINE([STAT_STATFS4], [1], 222 AC_DEFINE([STAT_STATFS4], [1],
153 [ Define if statfs takes 4 args. (SVR3, Dynix, Irix, Dolphin)]) 223 [ Define if statfs takes 4 args. (SVR3, Dynix, old Irix, old AIX, Dolphin)])
154 fi 224 fi
155fi 225fi
156 226
157if test $ac_fsusage_space = no; then 227if test $ac_fsusage_space = no; then
158# 4.4BSD and NetBSD 228 # 4.4BSD and older NetBSD
159 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl 229 # (OSF/1 already handled above.)
230 # (On AIX, you need to include <sys/statfs.h>, not only <sys/mount.h>.)
231 # (On Solaris, statfs has 4 arguments and 'struct statfs' is not declared in
232 # <sys/mount.h>.)
233 AC_MSG_CHECKING([for two-argument statfs with statfs.f_fsize dnl
160member (4.4BSD and NetBSD)]) 234member (4.4BSD and NetBSD)])
161 AC_CACHE_VAL([fu_cv_sys_stat_statfs2_fsize], 235 AC_CACHE_VAL([fu_cv_sys_stat_statfs2_fsize],
162 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ 236 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
@@ -223,6 +297,7 @@ fi
223 297
224if test $ac_fsusage_space = no; then 298if test $ac_fsusage_space = no; then
225 # SVR2 299 # SVR2
300 # (AIX, HP-UX, OSF/1 already handled above.)
226 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <sys/filsys.h> 301 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <sys/filsys.h>
227 ]])], 302 ]])],
228 [AC_DEFINE([STAT_READ_FILSYS], [1], 303 [AC_DEFINE([STAT_READ_FILSYS], [1],
diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4
index bc3066d..1d631f8 100644
--- a/gl/m4/getaddrinfo.m4
+++ b/gl/m4/getaddrinfo.m4
@@ -1,5 +1,5 @@
1# getaddrinfo.m4 serial 23 1# getaddrinfo.m4 serial 30
2dnl Copyright (C) 2004-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2004-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -24,6 +24,7 @@ AC_DEFUN([gl_GETADDRINFO],
24 fi]) 24 fi])
25 LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" 25 LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
26 26
27 HAVE_GETADDRINFO=1
27 AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [ 28 AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
28 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 29 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
29#include <sys/types.h> 30#include <sys/types.h>
@@ -55,16 +56,14 @@ AC_DEFUN([gl_GETADDRINFO],
55 GETADDRINFO_LIB="-lws2_32" 56 GETADDRINFO_LIB="-lws2_32"
56 LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" 57 LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
57 else 58 else
58 AC_LIBOBJ([getaddrinfo]) 59 HAVE_GETADDRINFO=0
59 fi 60 fi
60 fi 61 fi
61 62
62 # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an 63 # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an
63 # inline function declared in ws2tcpip.h, so we need to get that 64 # inline function declared in ws2tcpip.h, so we need to get that
64 # header included somehow. 65 # header included somehow.
65 AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)], 66 AC_CHECK_DECLS([gai_strerror], [], [], [[
66 gl_cv_func_gai_strerror, [
67 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
68#include <sys/types.h> 67#include <sys/types.h>
69#ifdef HAVE_SYS_SOCKET_H 68#ifdef HAVE_SYS_SOCKET_H
70#include <sys/socket.h> 69#include <sys/socket.h>
@@ -76,11 +75,46 @@ AC_DEFUN([gl_GETADDRINFO],
76#include <ws2tcpip.h> 75#include <ws2tcpip.h>
77#endif 76#endif
78#include <stddef.h> 77#include <stddef.h>
79]], [[gai_strerror (NULL);]])], 78]])
80 [gl_cv_func_gai_strerror=yes], 79 if test $ac_cv_have_decl_gai_strerror = yes; then
81 [gl_cv_func_gai_strerror=no])]) 80 AC_CHECK_DECLS([gai_strerrorA], [], [], [[
82 if test $gl_cv_func_gai_strerror = no; then 81#include <sys/types.h>
83 AC_LIBOBJ([gai_strerror]) 82#ifdef HAVE_SYS_SOCKET_H
83#include <sys/socket.h>
84#endif
85#ifdef HAVE_NETDB_H
86#include <netdb.h>
87#endif
88#ifdef HAVE_WS2TCPIP_H
89#include <ws2tcpip.h>
90#endif
91#include <stddef.h>
92]])
93 dnl check for correct signature
94 AC_CACHE_CHECK([for gai_strerror with POSIX signature],
95 [gl_cv_func_gai_strerror_posix_signature], [
96 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
97#include <sys/types.h>
98#ifdef HAVE_SYS_SOCKET_H
99#include <sys/socket.h>
100#endif
101#ifdef HAVE_NETDB_H
102#include <netdb.h>
103#endif
104#ifdef HAVE_WS2TCPIP_H
105#include <ws2tcpip.h>
106#endif
107#include <stddef.h>
108extern
109#ifdef __cplusplus
110"C"
111#endif
112const char *gai_strerror(int);]])],
113 [gl_cv_func_gai_strerror_posix_signature=yes],
114 [gl_cv_func_gai_strerror_posix_signature=no])])
115 if test $gl_cv_func_gai_strerror_posix_signature = no; then
116 REPLACE_GAI_STRERROR=1
117 fi
84 fi 118 fi
85 119
86 LIBS="$gai_saved_LIBS" 120 LIBS="$gai_saved_LIBS"
@@ -100,16 +134,18 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
100 AC_REQUIRE([AC_C_RESTRICT]) 134 AC_REQUIRE([AC_C_RESTRICT])
101 AC_REQUIRE([gl_SOCKET_FAMILIES]) 135 AC_REQUIRE([gl_SOCKET_FAMILIES])
102 AC_REQUIRE([gl_HEADER_SYS_SOCKET]) 136 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
103 AC_REQUIRE([AC_C_INLINE])
104 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) 137 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
105 138
106 dnl Including sys/socket.h is wrong for Windows, but Windows does not 139 dnl Including sys/socket.h is wrong for Windows, but Windows does not
107 dnl have sa_len so the result is correct anyway. 140 dnl have sa_len so the result is correct anyway.
108 AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [#include <sys/socket.h>]) 141 AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [
142#include <sys/types.h>
143#include <sys/socket.h>
144])
109 145
110 AC_CHECK_HEADERS_ONCE([netinet/in.h]) 146 AC_CHECK_HEADERS_ONCE([netinet/in.h])
111 147
112 AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[ 148 AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, getnameinfo],,,[[
113 /* sys/types.h is not needed according to POSIX, but the 149 /* sys/types.h is not needed according to POSIX, but the
114 sys/socket.h in i386-unknown-freebsd4.10 and 150 sys/socket.h in i386-unknown-freebsd4.10 and
115 powerpc-apple-darwin5.5 required it. */ 151 powerpc-apple-darwin5.5 required it. */
@@ -123,7 +159,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
123#ifdef HAVE_WS2TCPIP_H 159#ifdef HAVE_WS2TCPIP_H
124#include <ws2tcpip.h> 160#include <ws2tcpip.h>
125#endif 161#endif
126]) 162]])
127 if test $ac_cv_have_decl_getaddrinfo = no; then 163 if test $ac_cv_have_decl_getaddrinfo = no; then
128 HAVE_DECL_GETADDRINFO=0 164 HAVE_DECL_GETADDRINFO=0
129 fi 165 fi
diff --git a/gl/m4/getdtablesize.m4 b/gl/m4/getdtablesize.m4
deleted file mode 100644
index d238628..0000000
--- a/gl/m4/getdtablesize.m4
+++ /dev/null
@@ -1,15 +0,0 @@
1# getdtablesize.m4 serial 1
2dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_GETDTABLESIZE],
8[
9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
10 AC_CHECK_FUNCS_ONCE([getdtablesize])
11 if test $ac_cv_func_getdtablesize != yes; then
12 HAVE_GETDTABLESIZE=0
13 AC_LIBOBJ([getdtablesize])
14 fi
15])
diff --git a/gl/m4/gethostname.m4 b/gl/m4/gethostname.m4
index ef0b43e..7413f9e 100644
--- a/gl/m4/gethostname.m4
+++ b/gl/m4/gethostname.m4
@@ -1,5 +1,5 @@
1# gethostname.m4 serial 9 1# gethostname.m4 serial 13
2dnl Copyright (C) 2002, 2008, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -14,7 +14,7 @@ AC_DEFUN([gl_FUNC_GETHOSTNAME],
14 14
15 dnl Where is gethostname() defined? 15 dnl Where is gethostname() defined?
16 dnl - On native Windows, it is in ws2_32.dll. 16 dnl - On native Windows, it is in ws2_32.dll.
17 dnl - Otherwise is is in libc. 17 dnl - Otherwise it is in libc.
18 GETHOSTNAME_LIB= 18 GETHOSTNAME_LIB=
19 AC_CHECK_FUNCS([gethostname], , [ 19 AC_CHECK_FUNCS([gethostname], , [
20 AC_CACHE_CHECK([for gethostname in winsock2.h and -lws2_32], 20 AC_CACHE_CHECK([for gethostname in winsock2.h and -lws2_32],
@@ -37,12 +37,14 @@ AC_DEFUN([gl_FUNC_GETHOSTNAME],
37 AC_SUBST([GETHOSTNAME_LIB]) 37 AC_SUBST([GETHOSTNAME_LIB])
38 38
39 if test "$ac_cv_func_gethostname" = no; then 39 if test "$ac_cv_func_gethostname" = no; then
40 AC_LIBOBJ([gethostname])
41 HAVE_GETHOSTNAME=0 40 HAVE_GETHOSTNAME=0
42 gl_PREREQ_GETHOSTNAME
43 fi 41 fi
44 42
45 dnl Also provide HOST_NAME_MAX when <limits.h> lacks it. 43 gl_PREREQ_HOST_NAME_MAX
44])
45
46# Provide HOST_NAME_MAX when <limits.h> lacks it.
47AC_DEFUN([gl_PREREQ_HOST_NAME_MAX], [
46 dnl - On most Unix systems, use MAXHOSTNAMELEN from <sys/param.h> instead. 48 dnl - On most Unix systems, use MAXHOSTNAMELEN from <sys/param.h> instead.
47 dnl - On Solaris, Cygwin, BeOS, use MAXHOSTNAMELEN from <netdb.h> instead. 49 dnl - On Solaris, Cygwin, BeOS, use MAXHOSTNAMELEN from <netdb.h> instead.
48 dnl - On mingw, use 256, because 50 dnl - On mingw, use 256, because
@@ -83,7 +85,11 @@ lucky
83#if HAVE_NETDB_H 85#if HAVE_NETDB_H
84# include <netdb.h> 86# include <netdb.h>
85#endif 87#endif
86]) 88],
89 [dnl The system does not define MAXHOSTNAMELEN in any of the common
90 dnl headers. Use a safe fallback.
91 gl_cv_decl_HOST_NAME_MAX=256
92 ])
87 fi 93 fi
88 fi 94 fi
89 ]) 95 ])
diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4
index 0a731c4..611372a 100644
--- a/gl/m4/getloadavg.m4
+++ b/gl/m4/getloadavg.m4
@@ -1,108 +1,78 @@
1# Check for getloadavg. 1# Check for getloadavg.
2 2
3# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2010 Free Software 3# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2013 Free Software
4# Foundation, Inc. 4# Foundation, Inc.
5 5
6# This file is free software; the Free Software Foundation 6# This file is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it, 7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved. 8# with or without modifications, as long as this notice is preserved.
9 9
10#serial 6
11
10# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent. 12# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
11# New applications should use gl_GETLOADAVG instead. 13# New applications should use gl_GETLOADAVG instead.
12 14
13# gl_GETLOADAVG(LIBOBJDIR) 15# gl_GETLOADAVG
14# ------------------------ 16# -------------
15AC_DEFUN([gl_GETLOADAVG], 17AC_DEFUN([gl_GETLOADAVG],
16[AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 18[AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
17 19
18# Persuade glibc <stdlib.h> to declare getloadavg(). 20# Persuade glibc <stdlib.h> to declare getloadavg().
19AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) 21AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
20 22
21gl_have_func=no # yes means we've found a way to get the load average.
22
23# Make sure getloadavg.c is where it belongs, at configure-time.
24test -f "$srcdir/$1/getloadavg.c" ||
25 AC_MSG_ERROR([$srcdir/$1/getloadavg.c is missing])
26
27gl_save_LIBS=$LIBS 23gl_save_LIBS=$LIBS
28 24
29# Check for getloadavg, but be sure not to touch the cache variable. 25# getloadvg is present in libc on glibc >= 2.2, Mac OS X, FreeBSD >= 2.0,
30(AC_CHECK_FUNC([getloadavg], [exit 0], [exit 1])) && gl_have_func=yes 26# NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7.
31 27HAVE_GETLOADAVG=1
32# On HPUX9, an unprivileged user can get load averages through this function. 28AC_CHECK_FUNC([getloadavg], [],
33AC_CHECK_FUNCS([pstat_getdynamic]) 29 [gl_func_getloadavg_done=no
34 30
35# Solaris has libkstat which does not require root. 31 # Some systems with -lutil have (and need) -lkvm as well, some do not.
36AC_CHECK_LIB([kstat], [kstat_open]) 32 # On Solaris, -lkvm requires nlist from -lelf, so check that first
37test $ac_cv_lib_kstat_kstat_open = yes && gl_have_func=yes 33 # to get the right answer into the cache.
38 34 # For kstat on solaris, we need to test for libelf and libkvm to force the
39# AIX has libperfstat which does not require root 35 # definition of SVR4 below.
40AC_CHECK_LIB([perfstat], [perfstat_cpu_total]) 36 if test $gl_func_getloadavg_done = no; then
41test $ac_cv_lib_perfstat_perfstat_cpu_total = yes && gl_have_func=yes 37 AC_CHECK_LIB([elf], [elf_begin], [LIBS="-lelf $LIBS"])
42 38 AC_CHECK_LIB([kvm], [kvm_open], [LIBS="-lkvm $LIBS"])
43# Some systems with -lutil have (and need) -lkvm as well, some do not. 39 # Check for the 4.4BSD definition of getloadavg.
44# On Solaris, -lkvm requires nlist from -lelf, so check that first 40 AC_CHECK_LIB([util], [getloadavg],
45# to get the right answer into the cache. 41 [LIBS="-lutil $LIBS" gl_func_getloadavg_done=yes])
46# For kstat on solaris, we need libelf to force the definition of SVR4 below. 42 fi
47if test $gl_have_func = no; then 43
48 AC_CHECK_LIB([elf], [elf_begin], [LIBS="-lelf $LIBS"]) 44 if test $gl_func_getloadavg_done = no; then
49fi 45 # There is a commonly available library for RS/6000 AIX.
50if test $gl_have_func = no; then 46 # Since it is not a standard part of AIX, it might be installed locally.
51 AC_CHECK_LIB([kvm], [kvm_open], [LIBS="-lkvm $LIBS"]) 47 gl_getloadavg_LIBS=$LIBS
52 # Check for the 4.4BSD definition of getloadavg. 48 LIBS="-L/usr/local/lib $LIBS"
53 AC_CHECK_LIB([util], [getloadavg], 49 AC_CHECK_LIB([getloadavg], [getloadavg],
54 [LIBS="-lutil $LIBS" gl_have_func=yes gl_cv_func_getloadavg_setgid=yes]) 50 [LIBS="-lgetloadavg $LIBS" gl_func_getloadavg_done=yes],
55fi 51 [LIBS=$gl_getloadavg_LIBS])
52 fi
53
54 # Set up the replacement function if necessary.
55 if test $gl_func_getloadavg_done = no; then
56 HAVE_GETLOADAVG=0
57
58 # Solaris has libkstat which does not require root.
59 AC_CHECK_LIB([kstat], [kstat_open])
60 test $ac_cv_lib_kstat_kstat_open = yes && gl_func_getloadavg_done=yes
61
62 # AIX has libperfstat which does not require root
63 if test $gl_func_getloadavg_done = no; then
64 AC_CHECK_LIB([perfstat], [perfstat_cpu_total])
65 test $ac_cv_lib_perfstat_perfstat_cpu_total = yes && gl_func_getloadavg_done=yes
66 fi
67
68 if test $gl_func_getloadavg_done = no; then
69 AC_CHECK_HEADER([sys/dg_sys_info.h],
70 [gl_func_getloadavg_done=yes
71 AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.])
72 AC_CHECK_LIB([dgc], [dg_sys_info])])
73 fi
74 fi])
56 75
57if test $gl_have_func = no; then
58 # There is a commonly available library for RS/6000 AIX.
59 # Since it is not a standard part of AIX, it might be installed locally.
60 gl_getloadavg_LIBS=$LIBS
61 LIBS="-L/usr/local/lib $LIBS"
62 AC_CHECK_LIB([getloadavg], [getloadavg],
63 [LIBS="-lgetloadavg $LIBS"], [LIBS=$gl_getloadavg_LIBS])
64fi
65
66# Make sure it is really in the library, if we think we found it,
67# otherwise set up the replacement function.
68AC_CHECK_FUNCS([getloadavg], [],
69 [gl_PREREQ_GETLOADAVG])
70
71# Some definitions of getloadavg require that the program be installed setgid.
72AC_CACHE_CHECK([whether getloadavg requires setgid],
73 gl_cv_func_getloadavg_setgid,
74[AC_EGREP_CPP([Yowza Am I SETGID yet],
75[#define CONFIGURING_GETLOADAVG
76#include "$srcdir/$1/getloadavg.c"
77#ifdef LDAV_PRIVILEGED
78Yowza Am I SETGID yet
79#endif
80],
81 gl_cv_func_getloadavg_setgid=yes,
82 gl_cv_func_getloadavg_setgid=no)])
83if test $gl_cv_func_getloadavg_setgid = yes; then
84 NEED_SETGID=true
85 AC_DEFINE([GETLOADAVG_PRIVILEGED], [1],
86 [Define to 1 if the `getloadavg' function needs to be run setuid
87 or setgid.])
88else
89 NEED_SETGID=false
90fi
91AC_SUBST([NEED_SETGID])dnl
92
93if test $gl_cv_func_getloadavg_setgid = yes; then
94 AC_CACHE_CHECK([group of /dev/kmem], [gl_cv_group_kmem],
95[ # On Solaris, /dev/kmem is a symlink. Get info on the real file.
96 ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
97 # If we got an error (system does not support symlinks), try without -L.
98 test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
99 gl_cv_group_kmem=`echo $ac_ls_output \
100 | sed -ne ['s/[ ][ ]*/ /g
101 s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/
102 / /s/.* //;p']`
103])
104 AC_SUBST([KMEM_GROUP], [$gl_cv_group_kmem])dnl
105fi
106if test "x$gl_save_LIBS" = x; then 76if test "x$gl_save_LIBS" = x; then
107 GETLOADAVG_LIBS=$LIBS 77 GETLOADAVG_LIBS=$LIBS
108else 78else
@@ -121,58 +91,57 @@ else
121 HAVE_SYS_LOADAVG_H=0 91 HAVE_SYS_LOADAVG_H=0
122fi 92fi
123AC_CHECK_DECL([getloadavg], [], [HAVE_DECL_GETLOADAVG=0], 93AC_CHECK_DECL([getloadavg], [], [HAVE_DECL_GETLOADAVG=0],
124 [#if HAVE_SYS_LOADAVG_H 94 [[#if HAVE_SYS_LOADAVG_H
125 # include <sys/loadavg.h> 95 # include <sys/loadavg.h>
126 #endif 96 #endif
127 #include <stdlib.h>]) 97 #include <stdlib.h>]])
128])# gl_GETLOADAVG 98])# gl_GETLOADAVG
129 99
130 100
131# gl_PREREQ_GETLOADAVG 101# gl_PREREQ_GETLOADAVG
132# -------------------- 102# --------------------
133# Set up the AC_LIBOBJ replacement of `getloadavg'. 103# Set up the AC_LIBOBJ replacement of 'getloadavg'.
134AC_DEFUN([gl_PREREQ_GETLOADAVG], 104AC_DEFUN([gl_PREREQ_GETLOADAVG],
135[AC_LIBOBJ([getloadavg]) 105[
136AC_DEFINE([C_GETLOADAVG], [1], [Define to 1 if using `getloadavg.c'.])
137# Figure out what our getloadavg.c needs. 106# Figure out what our getloadavg.c needs.
138gl_have_func=no 107
139AC_CHECK_HEADER([sys/dg_sys_info.h], 108AC_CHECK_HEADERS_ONCE([sys/param.h])
140[gl_have_func=yes 109
141 AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.]) 110# On HPUX9, an unprivileged user can get load averages this way.
142 AC_CHECK_LIB([dgc], [dg_sys_info])]) 111if test $gl_func_getloadavg_done = no; then
112 AC_CHECK_FUNCS([pstat_getdynamic], [gl_func_getloadavg_done=yes])
113fi
143 114
144# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it 115# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
145# uses stabs), but it is still SVR4. We cannot check for <elf.h> because 116# uses stabs), but it is still SVR4. We cannot check for <elf.h> because
146# Irix 4.0.5F has the header but not the library. 117# Irix 4.0.5F has the header but not the library.
147if test $gl_have_func = no && test "$ac_cv_lib_elf_elf_begin" = yes; then 118if test $gl_func_getloadavg_done = no && test "$ac_cv_lib_elf_elf_begin" = yes \
148 gl_have_func=yes 119 && test "$ac_cv_lib_kvm_kvm_open" = yes; then
120 gl_func_getloadavg_done=yes
149 AC_DEFINE([SVR4], [1], [Define to 1 on System V Release 4.]) 121 AC_DEFINE([SVR4], [1], [Define to 1 on System V Release 4.])
150fi 122fi
151 123
152if test $gl_have_func = no; then 124if test $gl_func_getloadavg_done = no; then
153 AC_CHECK_HEADER([inq_stats/cpustats.h], 125 AC_CHECK_HEADER([inq_stats/cpustats.h],
154 [gl_have_func=yes 126 [gl_func_getloadavg_done=yes
155 AC_DEFINE([UMAX], [1], [Define to 1 for Encore UMAX.]) 127 AC_DEFINE([UMAX], [1], [Define to 1 for Encore UMAX.])
156 AC_DEFINE([UMAX4_3], [1], 128 AC_DEFINE([UMAX4_3], [1],
157 [Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h> 129 [Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h>
158 instead of <sys/cpustats.h>.])]) 130 instead of <sys/cpustats.h>.])])
159fi 131fi
160 132
161if test $gl_have_func = no; then 133if test $gl_func_getloadavg_done = no; then
162 AC_CHECK_HEADER([sys/cpustats.h], 134 AC_CHECK_HEADER([sys/cpustats.h],
163 [gl_have_func=yes; AC_DEFINE([UMAX])]) 135 [gl_func_getloadavg_done=yes; AC_DEFINE([UMAX])])
164fi 136fi
165 137
166if test $gl_have_func = no; then 138if test $gl_func_getloadavg_done = no; then
167 AC_CHECK_HEADERS([mach/mach.h]) 139 AC_CHECK_HEADERS([mach/mach.h])
168fi 140fi
169 141
170AC_CHECK_HEADERS([nlist.h], 142AC_CHECK_HEADERS([nlist.h],
171[AC_CHECK_MEMBERS([struct nlist.n_un.n_name], 143[AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
172 [AC_DEFINE([NLIST_NAME_UNION], [1], 144 [], [],
173 [Define to 1 if your `struct nlist' has an
174 `n_un' member. Obsolete, depend on
175 `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [],
176 [@%:@include <nlist.h>]) 145 [@%:@include <nlist.h>])
177 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]], 146 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
178 [[struct nlist x; 147 [[struct nlist x;
diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4
index 5b211e5..50f4509 100644
--- a/gl/m4/getopt.m4
+++ b/gl/m4/getopt.m4
@@ -1,5 +1,5 @@
1# getopt.m4 serial 28 1# getopt.m4 serial 44
2dnl Copyright (C) 2002-2006, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2006, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -9,10 +9,22 @@ AC_DEFUN([gl_FUNC_GETOPT_POSIX],
9[ 9[
10 m4_divert_text([DEFAULTS], [gl_getopt_required=POSIX]) 10 m4_divert_text([DEFAULTS], [gl_getopt_required=POSIX])
11 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) 11 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
12 gl_GETOPT_IFELSE([ 12 AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
13 gl_REPLACE_GETOPT 13 dnl Other modules can request the gnulib implementation of the getopt
14 ], 14 dnl functions unconditionally, by defining gl_REPLACE_GETOPT_ALWAYS.
15 []) 15 dnl argp.m4 does this.
16 m4_ifdef([gl_REPLACE_GETOPT_ALWAYS], [
17 REPLACE_GETOPT=1
18 ], [
19 REPLACE_GETOPT=0
20 if test -n "$gl_replace_getopt"; then
21 REPLACE_GETOPT=1
22 fi
23 ])
24 if test $REPLACE_GETOPT = 1; then
25 dnl Arrange for getopt.h to be created.
26 gl_GETOPT_SUBSTITUTE_HEADER
27 fi
16]) 28])
17 29
18# Request a POSIX compliant getopt function with GNU extensions (such as 30# Request a POSIX compliant getopt function with GNU extensions (such as
@@ -25,37 +37,16 @@ AC_DEFUN([gl_FUNC_GETOPT_GNU],
25 AC_REQUIRE([gl_FUNC_GETOPT_POSIX]) 37 AC_REQUIRE([gl_FUNC_GETOPT_POSIX])
26]) 38])
27 39
28# Request the gnulib implementation of the getopt functions unconditionally.
29# argp.m4 uses this.
30AC_DEFUN([gl_REPLACE_GETOPT],
31[
32 dnl Arrange for getopt.h to be created.
33 gl_GETOPT_SUBSTITUTE_HEADER
34 dnl Arrange for unistd.h to include getopt.h.
35 GNULIB_UNISTD_H_GETOPT=1
36 dnl Arrange to compile the getopt implementation.
37 AC_LIBOBJ([getopt])
38 AC_LIBOBJ([getopt1])
39 gl_PREREQ_GETOPT
40])
41
42# emacs' configure.in uses this.
43AC_DEFUN([gl_GETOPT_IFELSE],
44[
45 AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
46 AS_IF([test -n "$gl_replace_getopt"], [$1], [$2])
47])
48
49# Determine whether to replace the entire getopt facility. 40# Determine whether to replace the entire getopt facility.
50AC_DEFUN([gl_GETOPT_CHECK_HEADERS], 41AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
51[ 42[
52 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 43 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
44 AC_REQUIRE([AC_PROG_AWK]) dnl for awk that supports ENVIRON
53 45
54 dnl Persuade Solaris <unistd.h> to declare optarg, optind, opterr, optopt. 46 dnl Persuade Solaris <unistd.h> to declare optarg, optind, opterr, optopt.
55 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) 47 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
56 48
57 gl_CHECK_NEXT_HEADERS([getopt.h]) 49 gl_CHECK_NEXT_HEADERS([getopt.h])
58 AC_CHECK_HEADERS_ONCE([getopt.h])
59 if test $ac_cv_header_getopt_h = yes; then 50 if test $ac_cv_header_getopt_h = yes; then
60 HAVE_GETOPT_H=1 51 HAVE_GETOPT_H=1
61 else 52 else
@@ -75,25 +66,6 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
75 AC_CHECK_FUNCS([getopt_long_only], [], [gl_replace_getopt=yes]) 66 AC_CHECK_FUNCS([getopt_long_only], [], [gl_replace_getopt=yes])
76 fi 67 fi
77 68
78 dnl BSD getopt_long uses an incompatible method to reset option processing.
79 dnl Existence of the variable, in and of itself, is not a reason to replace
80 dnl getopt, but knowledge of the variable is needed to determine how to
81 dnl reset and whether a reset reparses the environment.
82 dnl Solaris supports neither optreset nor optind=0, but keeps no state that
83 dnl needs a reset beyond setting optind=1; detect Solaris by getopt_clip.
84 if test -z "$gl_replace_getopt"; then
85 AC_CHECK_DECLS([optreset], [],
86 [AC_CHECK_DECLS([getopt_clip], [], [],
87 [[#include <getopt.h>]])
88 ],
89 [[#include <getopt.h>]])
90 fi
91
92 dnl mingw's getopt (in libmingwex.a) does weird things when the options
93 dnl strings starts with '+' and it's not the first call. Some internal state
94 dnl is left over from earlier calls, and neither setting optind = 0 nor
95 dnl setting optreset = 1 get rid of this internal state.
96 dnl POSIX is silent on optind vs. optreset, so we allow either behavior.
97 dnl POSIX 2008 does not specify leading '+' behavior, but see 69 dnl POSIX 2008 does not specify leading '+' behavior, but see
98 dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on 70 dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on
99 dnl the next version of POSIX. For now, we only guarantee leading '+' 71 dnl the next version of POSIX. For now, we only guarantee leading '+'
@@ -102,105 +74,124 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
102 AC_CACHE_CHECK([whether getopt is POSIX compatible], 74 AC_CACHE_CHECK([whether getopt is POSIX compatible],
103 [gl_cv_func_getopt_posix], 75 [gl_cv_func_getopt_posix],
104 [ 76 [
105 dnl This test fails on mingw and succeeds on all other platforms. 77 dnl Merging these three different test programs into a single one
106 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 78 dnl would require a reset mechanism. On BSD systems, it can be done
79 dnl through 'optreset'; on some others (glibc), it can be done by
80 dnl setting 'optind' to 0; on others again (HP-UX, IRIX, OSF/1,
81 dnl Solaris 9, musl libc), there is no such mechanism.
82 if test $cross_compiling = no; then
83 dnl Sanity check. Succeeds everywhere (except on MSVC,
84 dnl which lacks <unistd.h> and getopt() entirely).
85 AC_RUN_IFELSE(
86 [AC_LANG_SOURCE([[
107#include <unistd.h> 87#include <unistd.h>
108#include <stdlib.h> 88#include <stdlib.h>
109#include <string.h> 89#include <string.h>
110 90
111#if !HAVE_DECL_OPTRESET && !HAVE_DECL_GETOPT_CLIP
112# define OPTIND_MIN 0
113#else
114# define OPTIND_MIN 1
115#endif
116
117int 91int
118main () 92main ()
119{ 93{
120 { 94 static char program[] = "program";
121 int argc = 0; 95 static char a[] = "-a";
122 char *argv[10]; 96 static char foo[] = "foo";
123 int c; 97 static char bar[] = "bar";
124 98 char *argv[] = { program, a, foo, bar, NULL };
125 argv[argc++] = "program"; 99 int c;
126 argv[argc++] = "-a";
127 argv[argc++] = "foo";
128 argv[argc++] = "bar";
129 argv[argc] = NULL;
130 optind = OPTIND_MIN;
131 opterr = 0;
132 100
133 c = getopt (argc, argv, "ab"); 101 c = getopt (4, argv, "ab");
134 if (!(c == 'a')) 102 if (!(c == 'a'))
135 return 1; 103 return 1;
136 c = getopt (argc, argv, "ab"); 104 c = getopt (4, argv, "ab");
137 if (!(c == -1)) 105 if (!(c == -1))
138 return 2; 106 return 2;
139 if (!(optind == 2)) 107 if (!(optind == 2))
140 return 3; 108 return 3;
141 } 109 return 0;
142 /* Some internal state exists at this point. */ 110}
143 { 111]])],
144 int argc = 0; 112 [gl_cv_func_getopt_posix=maybe],
145 char *argv[10]; 113 [gl_cv_func_getopt_posix=no])
146 int c; 114 if test $gl_cv_func_getopt_posix = maybe; then
115 dnl Sanity check with '+'. Succeeds everywhere (except on MSVC,
116 dnl which lacks <unistd.h> and getopt() entirely).
117 AC_RUN_IFELSE(
118 [AC_LANG_SOURCE([[
119#include <unistd.h>
120#include <stdlib.h>
121#include <string.h>
147 122
148 argv[argc++] = "program"; 123int
149 argv[argc++] = "donald"; 124main ()
150 argv[argc++] = "-p"; 125{
151 argv[argc++] = "billy"; 126 static char program[] = "program";
152 argv[argc++] = "duck"; 127 static char donald[] = "donald";
153 argv[argc++] = "-a"; 128 static char p[] = "-p";
154 argv[argc++] = "bar"; 129 static char billy[] = "billy";
155 argv[argc] = NULL; 130 static char duck[] = "duck";
156 optind = OPTIND_MIN; 131 static char a[] = "-a";
157 opterr = 0; 132 static char bar[] = "bar";
133 char *argv[] = { program, donald, p, billy, duck, a, bar, NULL };
134 int c;
158 135
159 c = getopt (argc, argv, "+abp:q:"); 136 c = getopt (7, argv, "+abp:q:");
160 if (!(c == -1)) 137 if (!(c == -1))
161 return 4; 138 return 4;
162 if (!(strcmp (argv[0], "program") == 0)) 139 if (!(strcmp (argv[0], "program") == 0))
163 return 5; 140 return 5;
164 if (!(strcmp (argv[1], "donald") == 0)) 141 if (!(strcmp (argv[1], "donald") == 0))
165 return 6; 142 return 6;
166 if (!(strcmp (argv[2], "-p") == 0)) 143 if (!(strcmp (argv[2], "-p") == 0))
167 return 7; 144 return 7;
168 if (!(strcmp (argv[3], "billy") == 0)) 145 if (!(strcmp (argv[3], "billy") == 0))
169 return 8; 146 return 8;
170 if (!(strcmp (argv[4], "duck") == 0)) 147 if (!(strcmp (argv[4], "duck") == 0))
171 return 9; 148 return 9;
172 if (!(strcmp (argv[5], "-a") == 0)) 149 if (!(strcmp (argv[5], "-a") == 0))
173 return 10; 150 return 10;
174 if (!(strcmp (argv[6], "bar") == 0)) 151 if (!(strcmp (argv[6], "bar") == 0))
175 return 11; 152 return 11;
176 if (!(optind == 1)) 153 if (!(optind == 1))
177 return 12; 154 return 12;
178 } 155 return 0;
179 /* Detect MacOS 10.5 bug. */ 156}
180 { 157]])],
181 char *argv[3] = { "program", "-ab", NULL }; 158 [gl_cv_func_getopt_posix=maybe],
182 optind = OPTIND_MIN; 159 [gl_cv_func_getopt_posix=no])
183 opterr = 0; 160 fi
184 if (getopt (2, argv, "ab:") != 'a') 161 if test $gl_cv_func_getopt_posix = maybe; then
185 return 13; 162 dnl Detect Mac OS X 10.5, AIX 7.1, mingw bug.
186 if (getopt (2, argv, "ab:") != '?') 163 AC_RUN_IFELSE(
187 return 14; 164 [AC_LANG_SOURCE([[
188 if (optopt != 'b') 165#include <unistd.h>
189 return 15; 166#include <stdlib.h>
190 if (optind != 2) 167#include <string.h>
191 return 16;
192 }
193 168
169int
170main ()
171{
172 static char program[] = "program";
173 static char ab[] = "-ab";
174 char *argv[3] = { program, ab, NULL };
175 if (getopt (2, argv, "ab:") != 'a')
176 return 13;
177 if (getopt (2, argv, "ab:") != '?')
178 return 14;
179 if (optopt != 'b')
180 return 15;
181 if (optind != 2)
182 return 16;
194 return 0; 183 return 0;
195} 184}
196]])], 185]])],
197 [gl_cv_func_getopt_posix=yes], [gl_cv_func_getopt_posix=no], 186 [gl_cv_func_getopt_posix=yes],
198 [case "$host_os" in 187 [gl_cv_func_getopt_posix=no])
199 mingw*) gl_cv_func_getopt_posix="guessing no";; 188 fi
200 darwin*) gl_cv_func_getopt_posix="guessing no";; 189 else
201 *) gl_cv_func_getopt_posix="guessing yes";; 190 case "$host_os" in
202 esac 191 darwin* | aix* | mingw*) gl_cv_func_getopt_posix="guessing no";;
203 ]) 192 *) gl_cv_func_getopt_posix="guessing yes";;
193 esac
194 fi
204 ]) 195 ])
205 case "$gl_cv_func_getopt_posix" in 196 case "$gl_cv_func_getopt_posix" in
206 *no) gl_replace_getopt=yes ;; 197 *no) gl_replace_getopt=yes ;;
@@ -213,82 +204,154 @@ main ()
213 # optstring is necessary for programs like m4 that have POSIX-mandated 204 # optstring is necessary for programs like m4 that have POSIX-mandated
214 # semantics for supporting options interspersed with files. 205 # semantics for supporting options interspersed with files.
215 # Also, since getopt_long is a GNU extension, we require optind=0. 206 # Also, since getopt_long is a GNU extension, we require optind=0.
216 gl_had_POSIXLY_CORRECT=${POSIXLY_CORRECT:+yes} 207 # Bash ties 'set -o posix' to a non-exported POSIXLY_CORRECT;
208 # so take care to revert to the correct (non-)export state.
209dnl GNU Coding Standards currently allow awk but not env; besides, env
210dnl is ambiguous with environment values that contain newlines.
211 gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }'
212 case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" </dev/null` in
213 xx) gl_had_POSIXLY_CORRECT=exported ;;
214 x) gl_had_POSIXLY_CORRECT=yes ;;
215 *) gl_had_POSIXLY_CORRECT= ;;
216 esac
217 POSIXLY_CORRECT=1 217 POSIXLY_CORRECT=1
218 export POSIXLY_CORRECT 218 export POSIXLY_CORRECT
219 AC_RUN_IFELSE( 219 AC_RUN_IFELSE(
220 [AC_LANG_PROGRAM([[#include <getopt.h> 220 [AC_LANG_PROGRAM([[#include <getopt.h>
221 #include <stddef.h> 221 #include <stddef.h>
222 #include <string.h> 222 #include <string.h>
223 ]GL_NOCRASH[
223 ]], [[ 224 ]], [[
225 int result = 0;
226
227 nocrash_init();
228
224 /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw, 229 /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw,
225 and fails on MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, 230 and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5,
226 OSF/1 5.1, Solaris 10. */ 231 OSF/1 5.1, Solaris 10. */
227 { 232 {
228 char *myargv[3]; 233 static char conftest[] = "conftest";
229 myargv[0] = "conftest"; 234 static char plus[] = "-+";
230 myargv[1] = "-+"; 235 char *argv[3] = { conftest, plus, NULL };
231 myargv[2] = 0;
232 opterr = 0; 236 opterr = 0;
233 if (getopt (2, myargv, "+a") != '?') 237 if (getopt (2, argv, "+a") != '?')
234 return 1; 238 result |= 1;
235 } 239 }
236 /* This code succeeds on glibc 2.8, mingw, 240 /* This code succeeds on glibc 2.8, mingw,
237 and fails on MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, 241 and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11,
238 IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ 242 IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */
239 { 243 {
240 char *argv[] = { "program", "-p", "foo", "bar", NULL }; 244 static char program[] = "program";
245 static char p[] = "-p";
246 static char foo[] = "foo";
247 static char bar[] = "bar";
248 char *argv[] = { program, p, foo, bar, NULL };
241 249
242 optind = 1; 250 optind = 1;
243 if (getopt (4, argv, "p::") != 'p') 251 if (getopt (4, argv, "p::") != 'p')
244 return 2; 252 result |= 2;
245 if (optarg != NULL) 253 else if (optarg != NULL)
246 return 3; 254 result |= 4;
247 if (getopt (4, argv, "p::") != -1) 255 else if (getopt (4, argv, "p::") != -1)
248 return 4; 256 result |= 6;
249 if (optind != 2) 257 else if (optind != 2)
250 return 5; 258 result |= 8;
251 } 259 }
252 /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */ 260 /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */
253 { 261 {
254 char *argv[] = { "program", "foo", "-p", NULL }; 262 static char program[] = "program";
263 static char foo[] = "foo";
264 static char p[] = "-p";
265 char *argv[] = { program, foo, p, NULL };
255 optind = 0; 266 optind = 0;
256 if (getopt (3, argv, "-p") != 1) 267 if (getopt (3, argv, "-p") != 1)
257 return 6; 268 result |= 16;
258 if (getopt (3, argv, "-p") != 'p') 269 else if (getopt (3, argv, "-p") != 'p')
259 return 7; 270 result |= 16;
260 } 271 }
261 /* This code fails on glibc 2.11. */ 272 /* This code fails on glibc 2.11. */
262 { 273 {
263 char *argv[] = { "program", "-b", "-a", NULL }; 274 static char program[] = "program";
275 static char b[] = "-b";
276 static char a[] = "-a";
277 char *argv[] = { program, b, a, NULL };
264 optind = opterr = 0; 278 optind = opterr = 0;
265 if (getopt (3, argv, "+:a:b") != 'b') 279 if (getopt (3, argv, "+:a:b") != 'b')
266 return 8; 280 result |= 32;
267 if (getopt (3, argv, "+:a:b") != ':') 281 else if (getopt (3, argv, "+:a:b") != ':')
268 return 9; 282 result |= 32;
283 }
284 /* This code dumps core on glibc 2.14. */
285 {
286 static char program[] = "program";
287 static char w[] = "-W";
288 static char dummy[] = "dummy";
289 char *argv[] = { program, w, dummy, NULL };
290 optind = opterr = 1;
291 if (getopt (3, argv, "W;") != 'W')
292 result |= 64;
269 } 293 }
270 return 0; 294 return result;
271 ]])], 295 ]])],
272 [gl_cv_func_getopt_gnu=yes], 296 [gl_cv_func_getopt_gnu=yes],
273 [gl_cv_func_getopt_gnu=no], 297 [gl_cv_func_getopt_gnu=no],
274 [dnl Cross compiling. Guess based on host and declarations. 298 [dnl Cross compiling. Assume the worst, even on glibc platforms.
275 case $host_os:$ac_cv_have_decl_optreset in 299 gl_cv_func_getopt_gnu="guessing no"
276 *-gnu*:* | mingw*:*) gl_cv_func_getopt_gnu=no;;
277 *:yes) gl_cv_func_getopt_gnu=no;;
278 *) gl_cv_func_getopt_gnu=yes;;
279 esac
280 ]) 300 ])
281 if test "$gl_had_POSIXLY_CORRECT" != yes; then 301 case $gl_had_POSIXLY_CORRECT in
282 AS_UNSET([POSIXLY_CORRECT]) 302 exported) ;;
283 fi 303 yes) AS_UNSET([POSIXLY_CORRECT]); POSIXLY_CORRECT=1 ;;
304 *) AS_UNSET([POSIXLY_CORRECT]) ;;
305 esac
284 ]) 306 ])
285 if test "$gl_cv_func_getopt_gnu" = "no"; then 307 if test "$gl_cv_func_getopt_gnu" != yes; then
286 gl_replace_getopt=yes 308 gl_replace_getopt=yes
309 else
310 AC_CACHE_CHECK([for working GNU getopt_long function],
311 [gl_cv_func_getopt_long_gnu],
312 [AC_RUN_IFELSE(
313 [AC_LANG_PROGRAM(
314 [[#include <getopt.h>
315 #include <stddef.h>
316 #include <string.h>
317 ]],
318 [[static const struct option long_options[] =
319 {
320 { "xtremely-",no_argument, NULL, 1003 },
321 { "xtra", no_argument, NULL, 1001 },
322 { "xtreme", no_argument, NULL, 1002 },
323 { "xtremely", no_argument, NULL, 1003 },
324 { NULL, 0, NULL, 0 }
325 };
326 /* This code fails on OpenBSD 5.0. */
327 {
328 static char program[] = "program";
329 static char xtremel[] = "--xtremel";
330 char *argv[] = { program, xtremel, NULL };
331 int option_index;
332 optind = 1; opterr = 0;
333 if (getopt_long (2, argv, "", long_options, &option_index) != 1003)
334 return 1;
335 }
336 return 0;
337 ]])],
338 [gl_cv_func_getopt_long_gnu=yes],
339 [gl_cv_func_getopt_long_gnu=no],
340 [dnl Cross compiling. Guess no on OpenBSD, yes otherwise.
341 case "$host_os" in
342 openbsd*) gl_cv_func_getopt_long_gnu="guessing no";;
343 *) gl_cv_func_getopt_long_gnu="guessing yes";;
344 esac
345 ])
346 ])
347 case "$gl_cv_func_getopt_long_gnu" in
348 *yes) ;;
349 *) gl_replace_getopt=yes ;;
350 esac
287 fi 351 fi
288 fi 352 fi
289]) 353])
290 354
291# emacs' configure.in uses this.
292AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], 355AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
293[ 356[
294 GETOPT_H=getopt.h 357 GETOPT_H=getopt.h
@@ -299,7 +362,6 @@ AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
299]) 362])
300 363
301# Prerequisites of lib/getopt*. 364# Prerequisites of lib/getopt*.
302# emacs' configure.in uses this.
303AC_DEFUN([gl_PREREQ_GETOPT], 365AC_DEFUN([gl_PREREQ_GETOPT],
304[ 366[
305 AC_CHECK_DECLS_ONCE([getenv]) 367 AC_CHECK_DECLS_ONCE([getenv])
diff --git a/gl/m4/gettext.m4 b/gl/m4/gettext.m4
index f84e6a5..8d1f066 100644
--- a/gl/m4/gettext.m4
+++ b/gl/m4/gettext.m4
@@ -1,5 +1,5 @@
1# gettext.m4 serial 63 (gettext-0.18) 1# gettext.m4 serial 66 (gettext-0.18.2)
2dnl Copyright (C) 1995-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 1995-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -35,7 +35,7 @@ dnl will be ignored. If NEEDSYMBOL is specified and is
35dnl 'need-formatstring-macros', then GNU gettext implementations that don't 35dnl 'need-formatstring-macros', then GNU gettext implementations that don't
36dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored. 36dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
37dnl INTLDIR is used to find the intl libraries. If empty, 37dnl INTLDIR is used to find the intl libraries. If empty,
38dnl the value `$(top_builddir)/intl/' is used. 38dnl the value '$(top_builddir)/intl/' is used.
39dnl 39dnl
40dnl The result of the configuration is one of three cases: 40dnl The result of the configuration is one of three cases:
41dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled 41dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
@@ -97,7 +97,7 @@ AC_DEFUN([AM_GNU_GETTEXT],
97 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) 97 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
98 ]) 98 ])
99 99
100 dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. 100 dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation.
101 gt_INTL_MACOSX 101 gt_INTL_MACOSX
102 102
103 dnl Set USE_NLS. 103 dnl Set USE_NLS.
@@ -157,12 +157,18 @@ changequote([,])dnl
157 fi 157 fi
158 158
159 AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc], 159 AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
160 [AC_TRY_LINK([#include <libintl.h> 160 [AC_LINK_IFELSE(
161 [AC_LANG_PROGRAM(
162 [[
163#include <libintl.h>
161$gt_revision_test_code 164$gt_revision_test_code
162extern int _nl_msg_cat_cntr; 165extern int _nl_msg_cat_cntr;
163extern int *_nl_domain_bindings;], 166extern int *_nl_domain_bindings;
164 [bindtextdomain ("", ""); 167 ]],
165return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings], 168 [[
169bindtextdomain ("", "");
170return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings
171 ]])],
166 [eval "$gt_func_gnugettext_libc=yes"], 172 [eval "$gt_func_gnugettext_libc=yes"],
167 [eval "$gt_func_gnugettext_libc=no"])]) 173 [eval "$gt_func_gnugettext_libc=no"])])
168 174
@@ -183,35 +189,47 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_b
183 gt_save_LIBS="$LIBS" 189 gt_save_LIBS="$LIBS"
184 LIBS="$LIBS $LIBINTL" 190 LIBS="$LIBS $LIBINTL"
185 dnl Now see whether libintl exists and does not depend on libiconv. 191 dnl Now see whether libintl exists and does not depend on libiconv.
186 AC_TRY_LINK([#include <libintl.h> 192 AC_LINK_IFELSE(
193 [AC_LANG_PROGRAM(
194 [[
195#include <libintl.h>
187$gt_revision_test_code 196$gt_revision_test_code
188extern int _nl_msg_cat_cntr; 197extern int _nl_msg_cat_cntr;
189extern 198extern
190#ifdef __cplusplus 199#ifdef __cplusplus
191"C" 200"C"
192#endif 201#endif
193const char *_nl_expand_alias (const char *);], 202const char *_nl_expand_alias (const char *);
194 [bindtextdomain ("", ""); 203 ]],
195return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], 204 [[
205bindtextdomain ("", "");
206return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")
207 ]])],
196 [eval "$gt_func_gnugettext_libintl=yes"], 208 [eval "$gt_func_gnugettext_libintl=yes"],
197 [eval "$gt_func_gnugettext_libintl=no"]) 209 [eval "$gt_func_gnugettext_libintl=no"])
198 dnl Now see whether libintl exists and depends on libiconv. 210 dnl Now see whether libintl exists and depends on libiconv.
199 if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then 211 if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
200 LIBS="$LIBS $LIBICONV" 212 LIBS="$LIBS $LIBICONV"
201 AC_TRY_LINK([#include <libintl.h> 213 AC_LINK_IFELSE(
214 [AC_LANG_PROGRAM(
215 [[
216#include <libintl.h>
202$gt_revision_test_code 217$gt_revision_test_code
203extern int _nl_msg_cat_cntr; 218extern int _nl_msg_cat_cntr;
204extern 219extern
205#ifdef __cplusplus 220#ifdef __cplusplus
206"C" 221"C"
207#endif 222#endif
208const char *_nl_expand_alias (const char *);], 223const char *_nl_expand_alias (const char *);
209 [bindtextdomain ("", ""); 224 ]],
210return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], 225 [[
211 [LIBINTL="$LIBINTL $LIBICONV" 226bindtextdomain ("", "");
212 LTLIBINTL="$LTLIBINTL $LTLIBICONV" 227return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")
213 eval "$gt_func_gnugettext_libintl=yes" 228 ]])],
214 ]) 229 [LIBINTL="$LIBINTL $LIBICONV"
230 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
231 eval "$gt_func_gnugettext_libintl=yes"
232 ])
215 fi 233 fi
216 CPPFLAGS="$gt_save_CPPFLAGS" 234 CPPFLAGS="$gt_save_CPPFLAGS"
217 LIBS="$gt_save_LIBS"]) 235 LIBS="$gt_save_LIBS"])
diff --git a/gl/m4/glibc2.m4 b/gl/m4/glibc2.m4
index f148c12..0e50682 100644
--- a/gl/m4/glibc2.m4
+++ b/gl/m4/glibc2.m4
@@ -1,5 +1,6 @@
1# glibc2.m4 serial 2 1# glibc2.m4 serial 3
2dnl Copyright (C) 2000-2002, 2004, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2013 Free Software Foundation,
3dnl Inc.
3dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
@@ -15,7 +16,7 @@ AC_DEFUN([gt_GLIBC2],
15 [ 16 [
16#include <features.h> 17#include <features.h>
17#ifdef __GNU_LIBRARY__ 18#ifdef __GNU_LIBRARY__
18 #if (__GLIBC__ >= 2) 19 #if (__GLIBC__ >= 2) && !defined __UCLIBC__
19 Lucky GNU user 20 Lucky GNU user
20 #endif 21 #endif
21#endif 22#endif
diff --git a/gl/m4/glibc21.m4 b/gl/m4/glibc21.m4
index 68ada9d..613fb2a 100644
--- a/gl/m4/glibc21.m4
+++ b/gl/m4/glibc21.m4
@@ -1,17 +1,18 @@
1# glibc21.m4 serial 4 1# glibc21.m4 serial 5
2dnl Copyright (C) 2000-2002, 2004, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2013 Free Software Foundation,
3dnl Inc.
3dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
6 7
7# Test for the GNU C Library, version 2.1 or newer. 8# Test for the GNU C Library, version 2.1 or newer, or uClibc.
8# From Bruno Haible. 9# From Bruno Haible.
9 10
10AC_DEFUN([gl_GLIBC21], 11AC_DEFUN([gl_GLIBC21],
11 [ 12 [
12 AC_CACHE_CHECK([whether we are using the GNU C Library 2.1 or newer], 13 AC_CACHE_CHECK([whether we are using the GNU C Library >= 2.1 or uClibc],
13 [ac_cv_gnu_library_2_1], 14 [ac_cv_gnu_library_2_1],
14 [AC_EGREP_CPP([Lucky GNU user], 15 [AC_EGREP_CPP([Lucky],
15 [ 16 [
16#include <features.h> 17#include <features.h>
17#ifdef __GNU_LIBRARY__ 18#ifdef __GNU_LIBRARY__
@@ -19,6 +20,9 @@ AC_DEFUN([gl_GLIBC21],
19 Lucky GNU user 20 Lucky GNU user
20 #endif 21 #endif
21#endif 22#endif
23#ifdef __UCLIBC__
24 Lucky user
25#endif
22 ], 26 ],
23 [ac_cv_gnu_library_2_1=yes], 27 [ac_cv_gnu_library_2_1=yes],
24 [ac_cv_gnu_library_2_1=no]) 28 [ac_cv_gnu_library_2_1=no])
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
index 1b6516d..2ed3509 100644
--- a/gl/m4/gnulib-cache.m4
+++ b/gl/m4/gnulib-cache.m4
@@ -1,21 +1,33 @@
1# Copyright (C) 2002-2010 Free Software Foundation, Inc. 1# Copyright (C) 2002-2013 Free Software Foundation, Inc.
2# 2#
3# This file is free software, distributed under the terms of the GNU 3# This file is free software; you can redistribute it and/or modify
4# General Public License. As a special exception to the GNU General 4# it under the terms of the GNU General Public License as published by
5# Public License, this file may be distributed as part of a program 5# the Free Software Foundation; either version 3 of the License, or
6# that contains a configuration script generated by Autoconf, under 6# (at your option) any later version.
7#
8# This file is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this file. If not, see <http://www.gnu.org/licenses/>.
15#
16# As a special exception to the GNU General Public License,
17# this file may be distributed as part of a program that
18# contains a configuration script generated by Autoconf, under
7# the same distribution terms as the rest of that program. 19# the same distribution terms as the rest of that program.
8# 20#
9# Generated by gnulib-tool. 21# Generated by gnulib-tool.
10# 22#
11# This file represents the specification of how gnulib-tool is used. 23# This file represents the specification of how gnulib-tool is used.
12# It acts as a cache: It is written and read by gnulib-tool. 24# It acts as a cache: It is written and read by gnulib-tool.
13# In projects using CVS, this file is meant to be stored in CVS, 25# In projects that use version control, this file is meant to be put under
14# like the configure.ac and various Makefile.am files. 26# version control, like the configure.ac and various Makefile.am files.
15 27
16 28
17# Specification in the form of a command-line invocation: 29# Specification in the form of a command-line invocation:
18# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-libtool --macro-prefix=gl --no-vc-files base64 crypto/sha1 dirname environ floorf fsusage getaddrinfo gethostname getloadavg getopt gettext mountlist regex setenv strsep timegm unsetenv vasprintf vsnprintf 30# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files base64 crypto/sha1 dirname environ floorf fsusage getaddrinfo gethostname getloadavg getopt-gnu gettext mountlist regex setenv strsep timegm unsetenv vasprintf vsnprintf
19 31
20# Specification in the form of a few gnulib-tool.m4 macro invocations: 32# Specification in the form of a few gnulib-tool.m4 macro invocations:
21gl_LOCAL_DIR([]) 33gl_LOCAL_DIR([])
@@ -29,7 +41,7 @@ gl_MODULES([
29 getaddrinfo 41 getaddrinfo
30 gethostname 42 gethostname
31 getloadavg 43 getloadavg
32 getopt 44 getopt-gnu
33 gettext 45 gettext
34 mountlist 46 mountlist
35 regex 47 regex
@@ -50,4 +62,5 @@ gl_LIB([libgnu])
50gl_MAKEFILE_NAME([]) 62gl_MAKEFILE_NAME([])
51gl_MACRO_PREFIX([gl]) 63gl_MACRO_PREFIX([gl])
52gl_PO_DOMAIN([]) 64gl_PO_DOMAIN([])
65gl_WITNESS_C_MACRO([])
53gl_VC_FILES([false]) 66gl_VC_FILES([false])
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4
index 4c7ac30..0ae5a9e 100644
--- a/gl/m4/gnulib-common.m4
+++ b/gl/m4/gnulib-common.m4
@@ -1,5 +1,5 @@
1# gnulib-common.m4 serial 20 1# gnulib-common.m4 serial 33
2dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -12,11 +12,25 @@ AC_DEFUN([gl_COMMON], [
12 AC_REQUIRE([gl_COMMON_BODY]) 12 AC_REQUIRE([gl_COMMON_BODY])
13]) 13])
14AC_DEFUN([gl_COMMON_BODY], [ 14AC_DEFUN([gl_COMMON_BODY], [
15 AH_VERBATIM([_Noreturn],
16[/* The _Noreturn keyword of C11. */
17#if ! (defined _Noreturn \
18 || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
19# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
20 || 0x5110 <= __SUNPRO_C)
21# define _Noreturn __attribute__ ((__noreturn__))
22# elif defined _MSC_VER && 1200 <= _MSC_VER
23# define _Noreturn __declspec (noreturn)
24# else
25# define _Noreturn
26# endif
27#endif
28])
15 AH_VERBATIM([isoc99_inline], 29 AH_VERBATIM([isoc99_inline],
16[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports 30[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
17 the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of 31 the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
18 earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. 32 earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
19 __APPLE__ && __MACH__ test for MacOS X. 33 __APPLE__ && __MACH__ test for Mac OS X.
20 __APPLE_CC__ tests for the Apple compiler and its version. 34 __APPLE_CC__ tests for the Apple compiler and its version.
21 __STDC_VERSION__ tests for the C99 mode. */ 35 __STDC_VERSION__ tests for the C99 mode. */
22#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ 36#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
@@ -34,6 +48,20 @@ AC_DEFUN([gl_COMMON_BODY], [
34/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name 48/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
35 is a misnomer outside of parameter lists. */ 49 is a misnomer outside of parameter lists. */
36#define _UNUSED_PARAMETER_ _GL_UNUSED 50#define _UNUSED_PARAMETER_ _GL_UNUSED
51
52/* The __pure__ attribute was added in gcc 2.96. */
53#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
54# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
55#else
56# define _GL_ATTRIBUTE_PURE /* empty */
57#endif
58
59/* The __const__ attribute was added in gcc 2.95. */
60#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
61# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
62#else
63# define _GL_ATTRIBUTE_CONST /* empty */
64#endif
37]) 65])
38 dnl Preparation for running test programs: 66 dnl Preparation for running test programs:
39 dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not 67 dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not
@@ -47,16 +75,49 @@ AC_DEFUN([gl_COMMON_BODY], [
47# expands to a C preprocessor expression that evaluates to 1 or 0, depending 75# expands to a C preprocessor expression that evaluates to 1 or 0, depending
48# whether a gnulib module that has been requested shall be considered present 76# whether a gnulib module that has been requested shall be considered present
49# or not. 77# or not.
50AC_DEFUN([gl_MODULE_INDICATOR_CONDITION], [1]) 78m4_define([gl_MODULE_INDICATOR_CONDITION], [1])
51 79
52# gl_MODULE_INDICATOR_SET_VARIABLE([modulename]) 80# gl_MODULE_INDICATOR_SET_VARIABLE([modulename])
53# sets the shell variable that indicates the presence of the given module to 81# sets the shell variable that indicates the presence of the given module to
54# a C preprocessor expression that will evaluate to 1. 82# a C preprocessor expression that will evaluate to 1.
55AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], 83AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE],
56[ 84[
57 GNULIB_[]m4_translit([[$1]], 85 gl_MODULE_INDICATOR_SET_VARIABLE_AUX(
58 [abcdefghijklmnopqrstuvwxyz./-], 86 [GNULIB_[]m4_translit([[$1]],
59 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=gl_MODULE_INDICATOR_CONDITION 87 [abcdefghijklmnopqrstuvwxyz./-],
88 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])],
89 [gl_MODULE_INDICATOR_CONDITION])
90])
91
92# gl_MODULE_INDICATOR_SET_VARIABLE_AUX([variable])
93# modifies the shell variable to include the gl_MODULE_INDICATOR_CONDITION.
94# The shell variable's value is a C preprocessor expression that evaluates
95# to 0 or 1.
96AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX],
97[
98 m4_if(m4_defn([gl_MODULE_INDICATOR_CONDITION]), [1],
99 [
100 dnl Simplify the expression VALUE || 1 to 1.
101 $1=1
102 ],
103 [gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([$1],
104 [gl_MODULE_INDICATOR_CONDITION])])
105])
106
107# gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([variable], [condition])
108# modifies the shell variable to include the given condition. The shell
109# variable's value is a C preprocessor expression that evaluates to 0 or 1.
110AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR],
111[
112 dnl Simplify the expression 1 || CONDITION to 1.
113 if test "$[]$1" != 1; then
114 dnl Simplify the expression 0 || CONDITION to CONDITION.
115 if test "$[]$1" = 0; then
116 $1=$2
117 else
118 $1="($[]$1 || $2)"
119 fi
120 fi
60]) 121])
61 122
62# gl_MODULE_INDICATOR([modulename]) 123# gl_MODULE_INDICATOR([modulename])
@@ -102,6 +163,40 @@ AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS],
102 [Define to 1 when the gnulib module $1 should be tested.]) 163 [Define to 1 when the gnulib module $1 should be tested.])
103]) 164])
104 165
166# gl_ASSERT_NO_GNULIB_POSIXCHECK
167# asserts that there will never be a need to #define GNULIB_POSIXCHECK.
168# and thereby enables an optimization of configure and config.h.
169# Used by Emacs.
170AC_DEFUN([gl_ASSERT_NO_GNULIB_POSIXCHECK],
171[
172 dnl Override gl_WARN_ON_USE_PREPARE.
173 dnl But hide this definition from 'aclocal'.
174 AC_DEFUN([gl_W][ARN_ON_USE_PREPARE], [])
175])
176
177# gl_ASSERT_NO_GNULIB_TESTS
178# asserts that there will be no gnulib tests in the scope of the configure.ac
179# and thereby enables an optimization of config.h.
180# Used by Emacs.
181AC_DEFUN([gl_ASSERT_NO_GNULIB_TESTS],
182[
183 dnl Override gl_MODULE_INDICATOR_FOR_TESTS.
184 AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], [])
185])
186
187# Test whether <features.h> exists.
188# Set HAVE_FEATURES_H.
189AC_DEFUN([gl_FEATURES_H],
190[
191 AC_CHECK_HEADERS_ONCE([features.h])
192 if test $ac_cv_header_features_h = yes; then
193 HAVE_FEATURES_H=1
194 else
195 HAVE_FEATURES_H=0
196 fi
197 AC_SUBST([HAVE_FEATURES_H])
198])
199
105# m4_foreach_w 200# m4_foreach_w
106# is a backport of autoconf-2.59c's m4_foreach_w. 201# is a backport of autoconf-2.59c's m4_foreach_w.
107# Remove this macro when we can assume autoconf >= 2.60. 202# Remove this macro when we can assume autoconf >= 2.60.
@@ -117,11 +212,90 @@ m4_ifndef([AS_VAR_IF],
117[m4_define([AS_VAR_IF], 212[m4_define([AS_VAR_IF],
118[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])]) 213[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])])
119 214
215# gl_PROG_CC_C99
216# Modifies the value of the shell variable CC in an attempt to make $CC
217# understand ISO C99 source code.
218# This is like AC_PROG_CC_C99, except that
219# - AC_PROG_CC_C99 did not exist in Autoconf versions < 2.60,
220# - AC_PROG_CC_C99 does not mix well with AC_PROG_CC_STDC
221# <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00367.html>,
222# but many more packages use AC_PROG_CC_STDC than AC_PROG_CC_C99
223# <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00441.html>.
224# Remaining problems:
225# - When AC_PROG_CC_STDC is invoked twice, it adds the C99 enabling options
226# to CC twice
227# <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00431.html>.
228# - AC_PROG_CC_STDC is likely to change now that C11 is an ISO standard.
229AC_DEFUN([gl_PROG_CC_C99],
230[
231 dnl Change that version number to the minimum Autoconf version that supports
232 dnl mixing AC_PROG_CC_C99 calls with AC_PROG_CC_STDC calls.
233 m4_version_prereq([9.0],
234 [AC_REQUIRE([AC_PROG_CC_C99])],
235 [AC_REQUIRE([AC_PROG_CC_STDC])])
236])
237
238# gl_PROG_AR_RANLIB
239# Determines the values for AR, ARFLAGS, RANLIB that fit with the compiler.
240# The user can set the variables AR, ARFLAGS, RANLIB if he wants to override
241# the values.
242AC_DEFUN([gl_PROG_AR_RANLIB],
243[
244 dnl Minix 3 comes with two toolchains: The Amsterdam Compiler Kit compiler
245 dnl as "cc", and GCC as "gcc". They have different object file formats and
246 dnl library formats. In particular, the GNU binutils programs ar, ranlib
247 dnl produce libraries that work only with gcc, not with cc.
248 AC_REQUIRE([AC_PROG_CC])
249 AC_CACHE_CHECK([for Minix Amsterdam compiler], [gl_cv_c_amsterdam_compiler],
250 [
251 AC_EGREP_CPP([Amsterdam],
252 [
253#ifdef __ACK__
254Amsterdam
255#endif
256 ],
257 [gl_cv_c_amsterdam_compiler=yes],
258 [gl_cv_c_amsterdam_compiler=no])
259 ])
260 if test -z "$AR"; then
261 if test $gl_cv_c_amsterdam_compiler = yes; then
262 AR='cc -c.a'
263 if test -z "$ARFLAGS"; then
264 ARFLAGS='-o'
265 fi
266 else
267 dnl Use the Automake-documented default values for AR and ARFLAGS,
268 dnl but prefer ${host}-ar over ar (useful for cross-compiling).
269 AC_CHECK_TOOL([AR], [ar], [ar])
270 if test -z "$ARFLAGS"; then
271 ARFLAGS='cru'
272 fi
273 fi
274 else
275 if test -z "$ARFLAGS"; then
276 ARFLAGS='cru'
277 fi
278 fi
279 AC_SUBST([AR])
280 AC_SUBST([ARFLAGS])
281 if test -z "$RANLIB"; then
282 if test $gl_cv_c_amsterdam_compiler = yes; then
283 RANLIB=':'
284 else
285 dnl Use the ranlib program if it is available.
286 AC_PROG_RANLIB
287 fi
288 fi
289 AC_SUBST([RANLIB])
290])
291
120# AC_PROG_MKDIR_P 292# AC_PROG_MKDIR_P
121# is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix 293# is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix
122# for interoperability with automake-1.9.6 from autoconf-2.62. 294# for interoperability with automake-1.9.6 from autoconf-2.62.
123# Remove this macro when we can assume autoconf >= 2.62 or 295# Remove this macro when we can assume autoconf >= 2.62 or
124# autoconf >= 2.60 && automake >= 1.10. 296# autoconf >= 2.60 && automake >= 1.10.
297# AC_AUTOCONF_VERSION was introduced in 2.62, so use that as the witness.
298m4_ifndef([AC_AUTOCONF_VERSION],[
125m4_ifdef([AC_PROG_MKDIR_P], [ 299m4_ifdef([AC_PROG_MKDIR_P], [
126 dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed. 300 dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed.
127 m4_define([AC_PROG_MKDIR_P], 301 m4_define([AC_PROG_MKDIR_P],
@@ -132,13 +306,15 @@ m4_ifdef([AC_PROG_MKDIR_P], [
132 [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake 306 [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
133 MKDIR_P='$(mkdir_p)' 307 MKDIR_P='$(mkdir_p)'
134 AC_SUBST([MKDIR_P])])]) 308 AC_SUBST([MKDIR_P])])])
309])
135 310
136# AC_C_RESTRICT 311# AC_C_RESTRICT
137# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61, 312# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61,
138# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++ 313# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++
139# works. 314# works.
140# This definition can be removed once autoconf >= 2.62 can be assumed. 315# This definition can be removed once autoconf >= 2.62 can be assumed.
141m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.62]),[-1],[ 316# AC_AUTOCONF_VERSION was introduced in 2.62, so use that as the witness.
317m4_ifndef([AC_AUTOCONF_VERSION],[
142AC_DEFUN([AC_C_RESTRICT], 318AC_DEFUN([AC_C_RESTRICT],
143[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict], 319[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict],
144 [ac_cv_c_restrict=no 320 [ac_cv_c_restrict=no
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index fc3f353..f23f769 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -1,10 +1,22 @@
1# DO NOT EDIT! GENERATED AUTOMATICALLY! 1# DO NOT EDIT! GENERATED AUTOMATICALLY!
2# Copyright (C) 2002-2010 Free Software Foundation, Inc. 2# Copyright (C) 2002-2013 Free Software Foundation, Inc.
3# 3#
4# This file is free software, distributed under the terms of the GNU 4# This file is free software; you can redistribute it and/or modify
5# General Public License. As a special exception to the GNU General 5# it under the terms of the GNU General Public License as published by
6# Public License, this file may be distributed as part of a program 6# the Free Software Foundation; either version 3 of the License, or
7# that contains a configuration script generated by Autoconf, under 7# (at your option) any later version.
8#
9# This file is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this file. If not, see <http://www.gnu.org/licenses/>.
16#
17# As a special exception to the GNU General Public License,
18# this file may be distributed as part of a program that
19# contains a configuration script generated by Autoconf, under
8# the same distribution terms as the rest of that program. 20# the same distribution terms as the rest of that program.
9# 21#
10# Generated by gnulib-tool. 22# Generated by gnulib-tool.
@@ -12,7 +24,8 @@
12# This file represents the compiled summary of the specification in 24# This file represents the compiled summary of the specification in
13# gnulib-cache.m4. It lists the computed macro invocations that need 25# gnulib-cache.m4. It lists the computed macro invocations that need
14# to be invoked from configure.ac. 26# to be invoked from configure.ac.
15# In projects using CVS, this file can be treated like other built files. 27# In projects that use version control, this file can be treated like
28# other built files.
16 29
17 30
18# This macro should be invoked from ./configure.in, in the section 31# This macro should be invoked from ./configure.in, in the section
@@ -24,42 +37,33 @@ AC_DEFUN([gl_EARLY],
24 m4_pattern_allow([^gl_ES$])dnl a valid locale name 37 m4_pattern_allow([^gl_ES$])dnl a valid locale name
25 m4_pattern_allow([^gl_LIBOBJS$])dnl a variable 38 m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
26 m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable 39 m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
27 AC_REQUIRE([AC_PROG_RANLIB]) 40 AC_REQUIRE([gl_PROG_AR_RANLIB])
28 # Code from module alignof: 41 AC_REQUIRE([AM_PROG_CC_C_O])
29 # Code from module alloca-opt: 42 # Code from module alloca-opt:
30 # Code from module arg-nonnull:
31 # Code from module arpa_inet: 43 # Code from module arpa_inet:
32 # Code from module base64: 44 # Code from module base64:
33 # Code from module btowc: 45 # Code from module btowc:
34 # Code from module c++defs:
35 # Code from module c-strtod:
36 # Code from module cloexec:
37 # Code from module close-hook:
38 # Code from module configmake: 46 # Code from module configmake:
39 # Code from module crypto/sha1: 47 # Code from module crypto/sha1:
40 # Code from module dirname: 48 # Code from module dirname:
41 # Code from module dirname-lgpl: 49 # Code from module dirname-lgpl:
50 # Code from module dosname:
42 # Code from module double-slash-root: 51 # Code from module double-slash-root:
43 # Code from module dup2:
44 # Code from module environ: 52 # Code from module environ:
45 # Code from module errno: 53 # Code from module errno:
46 # Code from module error: 54 # Code from module error:
47 # Code from module exitfail: 55 # Code from module exitfail:
48 # Code from module extensions: 56 # Code from module extensions:
49 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 57 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
50 # Code from module fcntl: 58 # Code from module extern-inline:
51 # Code from module fcntl-h: 59 # Code from module fd-hook:
52 # Code from module fcntl-safer:
53 # Code from module float: 60 # Code from module float:
54 # Code from module floorf: 61 # Code from module floorf:
55 # Code from module fsusage: 62 # Code from module fsusage:
56 # Code from module full-read: 63 # Code from module full-read:
57 # Code from module full-write:
58 # Code from module getaddrinfo: 64 # Code from module getaddrinfo:
59 # Code from module getdtablesize:
60 # Code from module gethostname: 65 # Code from module gethostname:
61 # Code from module getloadavg: 66 # Code from module getloadavg:
62 # Code from module getopt:
63 # Code from module getopt-gnu: 67 # Code from module getopt-gnu:
64 # Code from module getopt-posix: 68 # Code from module getopt-posix:
65 # Code from module gettext: 69 # Code from module gettext:
@@ -68,68 +72,81 @@ AC_DEFUN([gl_EARLY],
68 # Code from module hostent: 72 # Code from module hostent:
69 # Code from module include_next: 73 # Code from module include_next:
70 # Code from module inet_ntop: 74 # Code from module inet_ntop:
71 # Code from module inline:
72 # Code from module intprops: 75 # Code from module intprops:
73 # Code from module langinfo: 76 # Code from module langinfo:
77 # Code from module largefile:
78 AC_REQUIRE([AC_SYS_LARGEFILE])
74 # Code from module localcharset: 79 # Code from module localcharset:
75 # Code from module locale: 80 # Code from module locale:
76 # Code from module malloc: 81 # Code from module localeconv:
82 # Code from module lock:
83 # Code from module malloc-gnu:
77 # Code from module malloc-posix: 84 # Code from module malloc-posix:
78 # Code from module malloca: 85 # Code from module malloca:
79 # Code from module math: 86 # Code from module math:
80 # Code from module mbrtowc: 87 # Code from module mbrtowc:
81 # Code from module mbsinit: 88 # Code from module mbsinit:
89 # Code from module mbtowc:
82 # Code from module memchr: 90 # Code from module memchr:
83 # Code from module mktime: 91 # Code from module mktime:
92 # Code from module mktime-internal:
84 # Code from module mountlist: 93 # Code from module mountlist:
94 # Code from module msvc-inval:
95 # Code from module msvc-nothrow:
85 # Code from module multiarch: 96 # Code from module multiarch:
86 # Code from module netdb: 97 # Code from module netdb:
87 # Code from module netinet_in: 98 # Code from module netinet_in:
88 # Code from module nl_langinfo: 99 # Code from module nl_langinfo:
89 # Code from module open: 100 # Code from module nocrash:
101 # Code from module read:
90 # Code from module regex: 102 # Code from module regex:
91 # Code from module safe-read: 103 # Code from module safe-read:
92 # Code from module safe-write:
93 # Code from module servent: 104 # Code from module servent:
94 # Code from module setenv: 105 # Code from module setenv:
95 # Code from module size_max: 106 # Code from module size_max:
107 # Code from module snippet/_Noreturn:
108 # Code from module snippet/arg-nonnull:
109 # Code from module snippet/c++defs:
110 # Code from module snippet/warn-on-use:
96 # Code from module snprintf: 111 # Code from module snprintf:
112 # Code from module socketlib:
97 # Code from module sockets: 113 # Code from module sockets:
98 # Code from module socklen: 114 # Code from module socklen:
99 # Code from module ssize_t: 115 # Code from module ssize_t:
100 # Code from module stat: 116 # Code from module stdalign:
101 # Code from module stdbool: 117 # Code from module stdbool:
102 # Code from module stddef: 118 # Code from module stddef:
103 # Code from module stdint: 119 # Code from module stdint:
104 # Code from module stdio: 120 # Code from module stdio:
105 # Code from module stdlib: 121 # Code from module stdlib:
106 # Code from module strdup-posix:
107 # Code from module streq: 122 # Code from module streq:
108 # Code from module strerror: 123 # Code from module strerror:
124 # Code from module strerror-override:
109 # Code from module string: 125 # Code from module string:
110 # Code from module strndup: 126 # Code from module strndup:
111 # Code from module strnlen: 127 # Code from module strnlen:
112 # Code from module strsep: 128 # Code from module strsep:
113 # Code from module strstr-simple: 129 # Code from module strstr-simple:
114 # Code from module sys_socket: 130 # Code from module sys_socket:
115 # Code from module sys_stat: 131 # Code from module sys_types:
132 # Code from module sys_uio:
133 # Code from module threadlib:
134 gl_THREADLIB_EARLY
116 # Code from module time: 135 # Code from module time:
117 # Code from module time_r: 136 # Code from module time_r:
118 # Code from module timegm: 137 # Code from module timegm:
119 # Code from module unistd: 138 # Code from module unistd:
120 # Code from module unistd-safer:
121 # Code from module unsetenv: 139 # Code from module unsetenv:
122 # Code from module vasnprintf: 140 # Code from module vasnprintf:
123 # Code from module vasprintf: 141 # Code from module vasprintf:
124 # Code from module verify: 142 # Code from module verify:
125 # Code from module vsnprintf: 143 # Code from module vsnprintf:
126 # Code from module warn-on-use:
127 # Code from module wchar: 144 # Code from module wchar:
128 # Code from module wcrtomb: 145 # Code from module wcrtomb:
129 # Code from module wctype: 146 # Code from module wctype-h:
130 # Code from module write:
131 # Code from module xalloc: 147 # Code from module xalloc:
132 # Code from module xalloc-die: 148 # Code from module xalloc-die:
149 # Code from module xalloc-oversized:
133 # Code from module xsize: 150 # Code from module xsize:
134 # Code from module xstrndup: 151 # Code from module xstrndup:
135]) 152])
@@ -150,252 +167,296 @@ AC_DEFUN([gl_INIT],
150 m4_pushdef([gl_LIBSOURCES_DIR], []) 167 m4_pushdef([gl_LIBSOURCES_DIR], [])
151 gl_COMMON 168 gl_COMMON
152 gl_source_base='gl' 169 gl_source_base='gl'
153 # Code from module alignof:
154 # Code from module alloca-opt:
155 gl_FUNC_ALLOCA 170 gl_FUNC_ALLOCA
156 # Code from module arg-nonnull:
157 # Code from module arpa_inet:
158 gl_HEADER_ARPA_INET 171 gl_HEADER_ARPA_INET
159 AC_PROG_MKDIR_P 172 AC_PROG_MKDIR_P
160 # Code from module base64:
161 gl_FUNC_BASE64 173 gl_FUNC_BASE64
162 # Code from module btowc:
163 gl_FUNC_BTOWC 174 gl_FUNC_BTOWC
175 if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then
176 AC_LIBOBJ([btowc])
177 gl_PREREQ_BTOWC
178 fi
164 gl_WCHAR_MODULE_INDICATOR([btowc]) 179 gl_WCHAR_MODULE_INDICATOR([btowc])
165 # Code from module c++defs: 180 gl_CONFIGMAKE_PREP
166 # Code from module c-strtod:
167 gl_C_STRTOD
168 # Code from module cloexec:
169 gl_CLOEXEC
170 gl_MODULE_INDICATOR_FOR_TESTS([cloexec])
171 # Code from module close-hook:
172 # Code from module configmake:
173 # Code from module crypto/sha1:
174 gl_SHA1 181 gl_SHA1
175 # Code from module dirname:
176 gl_DIRNAME 182 gl_DIRNAME
177 gl_MODULE_INDICATOR([dirname]) 183 gl_MODULE_INDICATOR([dirname])
178 # Code from module dirname-lgpl:
179 gl_DIRNAME_LGPL 184 gl_DIRNAME_LGPL
180 # Code from module double-slash-root:
181 gl_DOUBLE_SLASH_ROOT 185 gl_DOUBLE_SLASH_ROOT
182 # Code from module dup2:
183 gl_FUNC_DUP2
184 gl_UNISTD_MODULE_INDICATOR([dup2])
185 # Code from module environ:
186 gl_ENVIRON 186 gl_ENVIRON
187 gl_UNISTD_MODULE_INDICATOR([environ]) 187 gl_UNISTD_MODULE_INDICATOR([environ])
188 # Code from module errno:
189 gl_HEADER_ERRNO_H 188 gl_HEADER_ERRNO_H
190 # Code from module error:
191 gl_ERROR 189 gl_ERROR
190 if test $ac_cv_lib_error_at_line = no; then
191 AC_LIBOBJ([error])
192 gl_PREREQ_ERROR
193 fi
192 m4_ifdef([AM_XGETTEXT_OPTION], 194 m4_ifdef([AM_XGETTEXT_OPTION],
193 [AM_][XGETTEXT_OPTION([--flag=error:3:c-format]) 195 [AM_][XGETTEXT_OPTION([--flag=error:3:c-format])
194 AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) 196 AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])])
195 # Code from module exitfail: 197 AC_REQUIRE([gl_EXTERN_INLINE])
196 # Code from module extensions:
197 # Code from module fcntl:
198 gl_FUNC_FCNTL
199 gl_FCNTL_MODULE_INDICATOR([fcntl])
200 # Code from module fcntl-h:
201 gl_FCNTL_H
202 # Code from module fcntl-safer:
203 gl_FCNTL_SAFER
204 gl_MODULE_INDICATOR([fcntl-safer])
205 # Code from module float:
206 gl_FLOAT_H 198 gl_FLOAT_H
207 # Code from module floorf: 199 if test $REPLACE_FLOAT_LDBL = 1; then
200 AC_LIBOBJ([float])
201 fi
202 if test $REPLACE_ITOLD = 1; then
203 AC_LIBOBJ([itold])
204 fi
208 gl_FUNC_FLOORF 205 gl_FUNC_FLOORF
206 if test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1; then
207 AC_LIBOBJ([floorf])
208 fi
209 gl_MATH_MODULE_INDICATOR([floorf]) 209 gl_MATH_MODULE_INDICATOR([floorf])
210 # Code from module fsusage:
211 gl_FSUSAGE 210 gl_FSUSAGE
212 # Code from module full-read: 211 if test $gl_cv_fs_space = yes; then
213 # Code from module full-write: 212 AC_LIBOBJ([fsusage])
214 # Code from module getaddrinfo: 213 gl_PREREQ_FSUSAGE_EXTRA
214 fi
215 gl_GETADDRINFO 215 gl_GETADDRINFO
216 if test $HAVE_GETADDRINFO = 0; then
217 AC_LIBOBJ([getaddrinfo])
218 fi
219 if test $HAVE_DECL_GAI_STRERROR = 0 || test $REPLACE_GAI_STRERROR = 1; then
220 AC_LIBOBJ([gai_strerror])
221 fi
216 gl_NETDB_MODULE_INDICATOR([getaddrinfo]) 222 gl_NETDB_MODULE_INDICATOR([getaddrinfo])
217 # Code from module getdtablesize:
218 gl_FUNC_GETDTABLESIZE
219 gl_UNISTD_MODULE_INDICATOR([getdtablesize])
220 # Code from module gethostname:
221 gl_FUNC_GETHOSTNAME 223 gl_FUNC_GETHOSTNAME
224 if test $HAVE_GETHOSTNAME = 0; then
225 AC_LIBOBJ([gethostname])
226 gl_PREREQ_GETHOSTNAME
227 fi
222 gl_UNISTD_MODULE_INDICATOR([gethostname]) 228 gl_UNISTD_MODULE_INDICATOR([gethostname])
223 # Code from module getloadavg: 229 gl_GETLOADAVG
224 gl_GETLOADAVG([$gl_source_base]) 230 if test $HAVE_GETLOADAVG = 0; then
231 AC_LIBOBJ([getloadavg])
232 gl_PREREQ_GETLOADAVG
233 fi
225 gl_STDLIB_MODULE_INDICATOR([getloadavg]) 234 gl_STDLIB_MODULE_INDICATOR([getloadavg])
226 # Code from module getopt:
227 # Code from module getopt-gnu:
228 gl_FUNC_GETOPT_GNU 235 gl_FUNC_GETOPT_GNU
236 if test $REPLACE_GETOPT = 1; then
237 AC_LIBOBJ([getopt])
238 AC_LIBOBJ([getopt1])
239 gl_PREREQ_GETOPT
240 dnl Arrange for unistd.h to include getopt.h.
241 GNULIB_GL_UNISTD_H_GETOPT=1
242 fi
243 AC_SUBST([GNULIB_GL_UNISTD_H_GETOPT])
229 gl_MODULE_INDICATOR_FOR_TESTS([getopt-gnu]) 244 gl_MODULE_INDICATOR_FOR_TESTS([getopt-gnu])
230 # Code from module getopt-posix:
231 gl_FUNC_GETOPT_POSIX 245 gl_FUNC_GETOPT_POSIX
232 # Code from module gettext: 246 if test $REPLACE_GETOPT = 1; then
247 AC_LIBOBJ([getopt])
248 AC_LIBOBJ([getopt1])
249 gl_PREREQ_GETOPT
250 dnl Arrange for unistd.h to include getopt.h.
251 GNULIB_GL_UNISTD_H_GETOPT=1
252 fi
253 AC_SUBST([GNULIB_GL_UNISTD_H_GETOPT])
233 dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac. 254 dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac.
234 AM_GNU_GETTEXT_VERSION([0.18.1]) 255 AM_GNU_GETTEXT_VERSION([0.18.1])
235 # Code from module gettext-h:
236 AC_SUBST([LIBINTL]) 256 AC_SUBST([LIBINTL])
237 AC_SUBST([LTLIBINTL]) 257 AC_SUBST([LTLIBINTL])
238 # Code from module havelib:
239 # Code from module hostent:
240 gl_HOSTENT 258 gl_HOSTENT
241 # Code from module include_next:
242 # Code from module inet_ntop:
243 gl_FUNC_INET_NTOP 259 gl_FUNC_INET_NTOP
260 if test $HAVE_INET_NTOP = 0 || test $REPLACE_INET_NTOP = 1; then
261 AC_LIBOBJ([inet_ntop])
262 gl_PREREQ_INET_NTOP
263 fi
244 gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) 264 gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
245 # Code from module inline:
246 gl_INLINE
247 # Code from module intprops:
248 # Code from module langinfo:
249 gl_LANGINFO_H 265 gl_LANGINFO_H
250 # Code from module localcharset: 266 AC_REQUIRE([gl_LARGEFILE])
251 gl_LOCALCHARSET 267 gl_LOCALCHARSET
252 LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\"" 268 LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(abs_top_builddir)/$gl_source_base\""
253 AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) 269 AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT])
254 # Code from module locale:
255 gl_LOCALE_H 270 gl_LOCALE_H
256 # Code from module malloc: 271 gl_FUNC_LOCALECONV
257 AC_FUNC_MALLOC 272 if test $REPLACE_LOCALECONV = 1; then
258 AC_DEFINE([GNULIB_MALLOC_GNU], 1, [Define to indicate the 'malloc' module.]) 273 AC_LIBOBJ([localeconv])
259 # Code from module malloc-posix: 274 gl_PREREQ_LOCALECONV
275 fi
276 gl_LOCALE_MODULE_INDICATOR([localeconv])
277 gl_LOCK
278 gl_MODULE_INDICATOR([lock])
279 gl_FUNC_MALLOC_GNU
280 if test $REPLACE_MALLOC = 1; then
281 AC_LIBOBJ([malloc])
282 fi
283 gl_MODULE_INDICATOR([malloc-gnu])
260 gl_FUNC_MALLOC_POSIX 284 gl_FUNC_MALLOC_POSIX
285 if test $REPLACE_MALLOC = 1; then
286 AC_LIBOBJ([malloc])
287 fi
261 gl_STDLIB_MODULE_INDICATOR([malloc-posix]) 288 gl_STDLIB_MODULE_INDICATOR([malloc-posix])
262 # Code from module malloca:
263 gl_MALLOCA 289 gl_MALLOCA
264 # Code from module math:
265 gl_MATH_H 290 gl_MATH_H
266 # Code from module mbrtowc:
267 gl_FUNC_MBRTOWC 291 gl_FUNC_MBRTOWC
292 if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then
293 AC_LIBOBJ([mbrtowc])
294 gl_PREREQ_MBRTOWC
295 fi
268 gl_WCHAR_MODULE_INDICATOR([mbrtowc]) 296 gl_WCHAR_MODULE_INDICATOR([mbrtowc])
269 # Code from module mbsinit:
270 gl_FUNC_MBSINIT 297 gl_FUNC_MBSINIT
298 if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then
299 AC_LIBOBJ([mbsinit])
300 gl_PREREQ_MBSINIT
301 fi
271 gl_WCHAR_MODULE_INDICATOR([mbsinit]) 302 gl_WCHAR_MODULE_INDICATOR([mbsinit])
272 # Code from module memchr: 303 gl_FUNC_MBTOWC
304 if test $REPLACE_MBTOWC = 1; then
305 AC_LIBOBJ([mbtowc])
306 gl_PREREQ_MBTOWC
307 fi
308 gl_STDLIB_MODULE_INDICATOR([mbtowc])
273 gl_FUNC_MEMCHR 309 gl_FUNC_MEMCHR
310 if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
311 AC_LIBOBJ([memchr])
312 gl_PREREQ_MEMCHR
313 fi
274 gl_STRING_MODULE_INDICATOR([memchr]) 314 gl_STRING_MODULE_INDICATOR([memchr])
275 # Code from module mktime:
276 gl_FUNC_MKTIME 315 gl_FUNC_MKTIME
316 if test $REPLACE_MKTIME = 1; then
317 AC_LIBOBJ([mktime])
318 gl_PREREQ_MKTIME
319 fi
277 gl_TIME_MODULE_INDICATOR([mktime]) 320 gl_TIME_MODULE_INDICATOR([mktime])
278 # Code from module mountlist: 321 gl_FUNC_MKTIME_INTERNAL
322 if test $REPLACE_MKTIME = 1; then
323 AC_LIBOBJ([mktime])
324 gl_PREREQ_MKTIME
325 fi
279 gl_MOUNTLIST 326 gl_MOUNTLIST
280 # Code from module multiarch: 327 if test $gl_cv_list_mounted_fs = yes; then
328 AC_LIBOBJ([mountlist])
329 gl_PREREQ_MOUNTLIST_EXTRA
330 fi
331 gl_MSVC_INVAL
332 if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
333 AC_LIBOBJ([msvc-inval])
334 fi
335 gl_MSVC_NOTHROW
336 if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
337 AC_LIBOBJ([msvc-nothrow])
338 fi
281 gl_MULTIARCH 339 gl_MULTIARCH
282 # Code from module netdb:
283 gl_HEADER_NETDB 340 gl_HEADER_NETDB
284 # Code from module netinet_in:
285 gl_HEADER_NETINET_IN 341 gl_HEADER_NETINET_IN
286 AC_PROG_MKDIR_P 342 AC_PROG_MKDIR_P
287 # Code from module nl_langinfo:
288 gl_FUNC_NL_LANGINFO 343 gl_FUNC_NL_LANGINFO
344 if test $HAVE_NL_LANGINFO = 0 || test $REPLACE_NL_LANGINFO = 1; then
345 AC_LIBOBJ([nl_langinfo])
346 fi
289 gl_LANGINFO_MODULE_INDICATOR([nl_langinfo]) 347 gl_LANGINFO_MODULE_INDICATOR([nl_langinfo])
290 # Code from module open: 348 gl_FUNC_READ
291 gl_FUNC_OPEN 349 if test $REPLACE_READ = 1; then
292 gl_FCNTL_MODULE_INDICATOR([open]) 350 AC_LIBOBJ([read])
293 # Code from module regex: 351 gl_PREREQ_READ
352 fi
353 gl_UNISTD_MODULE_INDICATOR([read])
294 gl_REGEX 354 gl_REGEX
295 # Code from module safe-read: 355 if test $ac_use_included_regex = yes; then
296 gl_SAFE_READ 356 AC_LIBOBJ([regex])
297 # Code from module safe-write: 357 gl_PREREQ_REGEX
298 gl_SAFE_WRITE 358 fi
299 # Code from module servent: 359 gl_PREREQ_SAFE_READ
300 gl_SERVENT 360 gl_SERVENT
301 # Code from module setenv:
302 gl_FUNC_SETENV 361 gl_FUNC_SETENV
362 if test $HAVE_SETENV = 0 || test $REPLACE_SETENV = 1; then
363 AC_LIBOBJ([setenv])
364 fi
303 gl_STDLIB_MODULE_INDICATOR([setenv]) 365 gl_STDLIB_MODULE_INDICATOR([setenv])
304 # Code from module size_max:
305 gl_SIZE_MAX 366 gl_SIZE_MAX
306 # Code from module snprintf:
307 gl_FUNC_SNPRINTF 367 gl_FUNC_SNPRINTF
308 gl_STDIO_MODULE_INDICATOR([snprintf]) 368 gl_STDIO_MODULE_INDICATOR([snprintf])
309 # Code from module sockets: 369 gl_MODULE_INDICATOR([snprintf])
370 gl_SOCKETLIB
310 gl_SOCKETS 371 gl_SOCKETS
311 # Code from module socklen:
312 gl_TYPE_SOCKLEN_T 372 gl_TYPE_SOCKLEN_T
313 # Code from module ssize_t:
314 gt_TYPE_SSIZE_T 373 gt_TYPE_SSIZE_T
315 # Code from module stat: 374 gl_STDALIGN_H
316 gl_FUNC_STAT
317 gl_SYS_STAT_MODULE_INDICATOR([stat])
318 # Code from module stdbool:
319 AM_STDBOOL_H 375 AM_STDBOOL_H
320 # Code from module stddef:
321 gl_STDDEF_H 376 gl_STDDEF_H
322 # Code from module stdint:
323 gl_STDINT_H 377 gl_STDINT_H
324 # Code from module stdio:
325 gl_STDIO_H 378 gl_STDIO_H
326 # Code from module stdlib:
327 gl_STDLIB_H 379 gl_STDLIB_H
328 # Code from module strdup-posix:
329 gl_FUNC_STRDUP_POSIX
330 gl_STRING_MODULE_INDICATOR([strdup])
331 # Code from module streq:
332 # Code from module strerror:
333 gl_FUNC_STRERROR 380 gl_FUNC_STRERROR
381 if test $REPLACE_STRERROR = 1; then
382 AC_LIBOBJ([strerror])
383 fi
384 gl_MODULE_INDICATOR([strerror])
334 gl_STRING_MODULE_INDICATOR([strerror]) 385 gl_STRING_MODULE_INDICATOR([strerror])
335 # Code from module string: 386 AC_REQUIRE([gl_HEADER_ERRNO_H])
387 AC_REQUIRE([gl_FUNC_STRERROR_0])
388 if test -n "$ERRNO_H" || test $REPLACE_STRERROR_0 = 1; then
389 AC_LIBOBJ([strerror-override])
390 gl_PREREQ_SYS_H_WINSOCK2
391 fi
336 gl_HEADER_STRING_H 392 gl_HEADER_STRING_H
337 # Code from module strndup:
338 gl_FUNC_STRNDUP 393 gl_FUNC_STRNDUP
394 if test $HAVE_STRNDUP = 0 || test $REPLACE_STRNDUP = 1; then
395 AC_LIBOBJ([strndup])
396 fi
339 gl_STRING_MODULE_INDICATOR([strndup]) 397 gl_STRING_MODULE_INDICATOR([strndup])
340 # Code from module strnlen:
341 gl_FUNC_STRNLEN 398 gl_FUNC_STRNLEN
399 if test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1; then
400 AC_LIBOBJ([strnlen])
401 gl_PREREQ_STRNLEN
402 fi
342 gl_STRING_MODULE_INDICATOR([strnlen]) 403 gl_STRING_MODULE_INDICATOR([strnlen])
343 # Code from module strsep:
344 gl_FUNC_STRSEP 404 gl_FUNC_STRSEP
405 if test $HAVE_STRSEP = 0; then
406 AC_LIBOBJ([strsep])
407 gl_PREREQ_STRSEP
408 fi
345 gl_STRING_MODULE_INDICATOR([strsep]) 409 gl_STRING_MODULE_INDICATOR([strsep])
346 # Code from module strstr-simple:
347 gl_FUNC_STRSTR_SIMPLE 410 gl_FUNC_STRSTR_SIMPLE
411 if test $REPLACE_STRSTR = 1; then
412 AC_LIBOBJ([strstr])
413 fi
348 gl_STRING_MODULE_INDICATOR([strstr]) 414 gl_STRING_MODULE_INDICATOR([strstr])
349 # Code from module sys_socket:
350 gl_HEADER_SYS_SOCKET 415 gl_HEADER_SYS_SOCKET
351 AC_PROG_MKDIR_P 416 AC_PROG_MKDIR_P
352 # Code from module sys_stat: 417 gl_SYS_TYPES_H
353 gl_HEADER_SYS_STAT_H
354 AC_PROG_MKDIR_P 418 AC_PROG_MKDIR_P
355 # Code from module time: 419 gl_HEADER_SYS_UIO
420 AC_PROG_MKDIR_P
421 gl_THREADLIB
356 gl_HEADER_TIME_H 422 gl_HEADER_TIME_H
357 # Code from module time_r:
358 gl_TIME_R 423 gl_TIME_R
424 if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
425 AC_LIBOBJ([time_r])
426 gl_PREREQ_TIME_R
427 fi
359 gl_TIME_MODULE_INDICATOR([time_r]) 428 gl_TIME_MODULE_INDICATOR([time_r])
360 # Code from module timegm:
361 gl_FUNC_TIMEGM 429 gl_FUNC_TIMEGM
430 if test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1; then
431 AC_LIBOBJ([timegm])
432 gl_PREREQ_TIMEGM
433 fi
362 gl_TIME_MODULE_INDICATOR([timegm]) 434 gl_TIME_MODULE_INDICATOR([timegm])
363 # Code from module unistd:
364 gl_UNISTD_H 435 gl_UNISTD_H
365 # Code from module unistd-safer:
366 gl_UNISTD_SAFER
367 # Code from module unsetenv:
368 gl_FUNC_UNSETENV 436 gl_FUNC_UNSETENV
437 if test $HAVE_UNSETENV = 0 || test $REPLACE_UNSETENV = 1; then
438 AC_LIBOBJ([unsetenv])
439 gl_PREREQ_UNSETENV
440 fi
369 gl_STDLIB_MODULE_INDICATOR([unsetenv]) 441 gl_STDLIB_MODULE_INDICATOR([unsetenv])
370 # Code from module vasnprintf:
371 gl_FUNC_VASNPRINTF 442 gl_FUNC_VASNPRINTF
372 # Code from module vasprintf:
373 gl_FUNC_VASPRINTF 443 gl_FUNC_VASPRINTF
374 gl_STDIO_MODULE_INDICATOR([vasprintf]) 444 gl_STDIO_MODULE_INDICATOR([vasprintf])
375 m4_ifdef([AM_XGETTEXT_OPTION], 445 m4_ifdef([AM_XGETTEXT_OPTION],
376 [AM_][XGETTEXT_OPTION([--flag=asprintf:2:c-format]) 446 [AM_][XGETTEXT_OPTION([--flag=asprintf:2:c-format])
377 AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) 447 AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])])
378 # Code from module verify:
379 # Code from module vsnprintf:
380 gl_FUNC_VSNPRINTF 448 gl_FUNC_VSNPRINTF
381 gl_STDIO_MODULE_INDICATOR([vsnprintf]) 449 gl_STDIO_MODULE_INDICATOR([vsnprintf])
382 # Code from module warn-on-use:
383 # Code from module wchar:
384 gl_WCHAR_H 450 gl_WCHAR_H
385 # Code from module wcrtomb:
386 gl_FUNC_WCRTOMB 451 gl_FUNC_WCRTOMB
452 if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then
453 AC_LIBOBJ([wcrtomb])
454 gl_PREREQ_WCRTOMB
455 fi
387 gl_WCHAR_MODULE_INDICATOR([wcrtomb]) 456 gl_WCHAR_MODULE_INDICATOR([wcrtomb])
388 # Code from module wctype:
389 gl_WCTYPE_H 457 gl_WCTYPE_H
390 # Code from module write:
391 gl_FUNC_WRITE
392 gl_UNISTD_MODULE_INDICATOR([write])
393 # Code from module xalloc:
394 gl_XALLOC 458 gl_XALLOC
395 # Code from module xalloc-die:
396 # Code from module xsize:
397 gl_XSIZE 459 gl_XSIZE
398 # Code from module xstrndup:
399 gl_XSTRNDUP 460 gl_XSTRNDUP
400 # End of code from modules 461 # End of code from modules
401 m4_ifval(gl_LIBSOURCES_LIST, [ 462 m4_ifval(gl_LIBSOURCES_LIST, [
@@ -537,11 +598,11 @@ AC_DEFUN([gltests_LIBSOURCES], [
537# This macro records the list of files which have been installed by 598# This macro records the list of files which have been installed by
538# gnulib-tool and may be removed by future gnulib-tool invocations. 599# gnulib-tool and may be removed by future gnulib-tool invocations.
539AC_DEFUN([gl_FILE_LIST], [ 600AC_DEFUN([gl_FILE_LIST], [
540 build-aux/arg-nonnull.h
541 build-aux/c++defs.h
542 build-aux/config.rpath 601 build-aux/config.rpath
543 build-aux/warn-on-use.h 602 build-aux/snippet/_Noreturn.h
544 lib/alignof.h 603 build-aux/snippet/arg-nonnull.h
604 build-aux/snippet/c++defs.h
605 build-aux/snippet/warn-on-use.h
545 lib/alloca.in.h 606 lib/alloca.in.h
546 lib/arpa_inet.in.h 607 lib/arpa_inet.in.h
547 lib/asnprintf.c 608 lib/asnprintf.c
@@ -551,30 +612,20 @@ AC_DEFUN([gl_FILE_LIST], [
551 lib/basename-lgpl.c 612 lib/basename-lgpl.c
552 lib/basename.c 613 lib/basename.c
553 lib/btowc.c 614 lib/btowc.c
554 lib/c-strtod.c
555 lib/c-strtod.h
556 lib/cloexec.c
557 lib/cloexec.h
558 lib/close-hook.c
559 lib/close-hook.h
560 lib/config.charset 615 lib/config.charset
561 lib/creat-safer.c
562 lib/dirname-lgpl.c 616 lib/dirname-lgpl.c
563 lib/dirname.c 617 lib/dirname.c
564 lib/dirname.h 618 lib/dirname.h
565 lib/dup-safer.c 619 lib/dosname.h
566 lib/dup2.c
567 lib/errno.in.h 620 lib/errno.in.h
568 lib/error.c 621 lib/error.c
569 lib/error.h 622 lib/error.h
570 lib/exitfail.c 623 lib/exitfail.c
571 lib/exitfail.h 624 lib/exitfail.h
572 lib/fcntl--.h 625 lib/fd-hook.c
573 lib/fcntl-safer.h 626 lib/fd-hook.h
574 lib/fcntl.c
575 lib/fcntl.in.h
576 lib/fd-safer.c
577 lib/float+.h 627 lib/float+.h
628 lib/float.c
578 lib/float.in.h 629 lib/float.in.h
579 lib/floor.c 630 lib/floor.c
580 lib/floorf.c 631 lib/floorf.c
@@ -583,10 +634,8 @@ AC_DEFUN([gl_FILE_LIST], [
583 lib/full-read.c 634 lib/full-read.c
584 lib/full-read.h 635 lib/full-read.h
585 lib/full-write.c 636 lib/full-write.c
586 lib/full-write.h
587 lib/gai_strerror.c 637 lib/gai_strerror.c
588 lib/getaddrinfo.c 638 lib/getaddrinfo.c
589 lib/getdtablesize.c
590 lib/gethostname.c 639 lib/gethostname.c
591 lib/getloadavg.c 640 lib/getloadavg.c
592 lib/getopt.c 641 lib/getopt.c
@@ -594,35 +643,45 @@ AC_DEFUN([gl_FILE_LIST], [
594 lib/getopt1.c 643 lib/getopt1.c
595 lib/getopt_int.h 644 lib/getopt_int.h
596 lib/gettext.h 645 lib/gettext.h
646 lib/glthread/lock.c
647 lib/glthread/lock.h
648 lib/glthread/threadlib.c
597 lib/inet_ntop.c 649 lib/inet_ntop.c
598 lib/intprops.h 650 lib/intprops.h
651 lib/itold.c
599 lib/langinfo.in.h 652 lib/langinfo.in.h
600 lib/localcharset.c 653 lib/localcharset.c
601 lib/localcharset.h 654 lib/localcharset.h
602 lib/locale.in.h 655 lib/locale.in.h
656 lib/localeconv.c
603 lib/malloc.c 657 lib/malloc.c
604 lib/malloca.c 658 lib/malloca.c
605 lib/malloca.h 659 lib/malloca.h
606 lib/malloca.valgrind 660 lib/malloca.valgrind
661 lib/math.c
607 lib/math.in.h 662 lib/math.in.h
608 lib/mbrtowc.c 663 lib/mbrtowc.c
609 lib/mbsinit.c 664 lib/mbsinit.c
665 lib/mbtowc-impl.h
666 lib/mbtowc.c
610 lib/memchr.c 667 lib/memchr.c
611 lib/memchr.valgrind 668 lib/memchr.valgrind
612 lib/mktime-internal.h 669 lib/mktime-internal.h
613 lib/mktime.c 670 lib/mktime.c
614 lib/mountlist.c 671 lib/mountlist.c
615 lib/mountlist.h 672 lib/mountlist.h
673 lib/msvc-inval.c
674 lib/msvc-inval.h
675 lib/msvc-nothrow.c
676 lib/msvc-nothrow.h
616 lib/netdb.in.h 677 lib/netdb.in.h
617 lib/netinet_in.in.h 678 lib/netinet_in.in.h
618 lib/nl_langinfo.c 679 lib/nl_langinfo.c
619 lib/open-safer.c
620 lib/open.c
621 lib/pipe-safer.c
622 lib/printf-args.c 680 lib/printf-args.c
623 lib/printf-args.h 681 lib/printf-args.h
624 lib/printf-parse.c 682 lib/printf-parse.c
625 lib/printf-parse.h 683 lib/printf-parse.h
684 lib/read.c
626 lib/ref-add.sin 685 lib/ref-add.sin
627 lib/ref-del.sin 686 lib/ref-del.sin
628 lib/regcomp.c 687 lib/regcomp.c
@@ -633,8 +692,6 @@ AC_DEFUN([gl_FILE_LIST], [
633 lib/regexec.c 692 lib/regexec.c
634 lib/safe-read.c 693 lib/safe-read.c
635 lib/safe-read.h 694 lib/safe-read.h
636 lib/safe-write.c
637 lib/safe-write.h
638 lib/setenv.c 695 lib/setenv.c
639 lib/sha1.c 696 lib/sha1.c
640 lib/sha1.h 697 lib/sha1.h
@@ -642,16 +699,16 @@ AC_DEFUN([gl_FILE_LIST], [
642 lib/snprintf.c 699 lib/snprintf.c
643 lib/sockets.c 700 lib/sockets.c
644 lib/sockets.h 701 lib/sockets.h
645 lib/stat.c 702 lib/stdalign.in.h
646 lib/stdbool.in.h 703 lib/stdbool.in.h
647 lib/stddef.in.h 704 lib/stddef.in.h
648 lib/stdint.in.h 705 lib/stdint.in.h
649 lib/stdio-write.c
650 lib/stdio.in.h 706 lib/stdio.in.h
651 lib/stdlib.in.h 707 lib/stdlib.in.h
652 lib/str-two-way.h 708 lib/str-two-way.h
653 lib/strdup.c
654 lib/streq.h 709 lib/streq.h
710 lib/strerror-override.c
711 lib/strerror-override.h
655 lib/strerror.c 712 lib/strerror.c
656 lib/string.in.h 713 lib/string.in.h
657 lib/stripslash.c 714 lib/stripslash.c
@@ -659,13 +716,14 @@ AC_DEFUN([gl_FILE_LIST], [
659 lib/strnlen.c 716 lib/strnlen.c
660 lib/strsep.c 717 lib/strsep.c
661 lib/strstr.c 718 lib/strstr.c
719 lib/sys_socket.c
662 lib/sys_socket.in.h 720 lib/sys_socket.in.h
663 lib/sys_stat.in.h 721 lib/sys_types.in.h
722 lib/sys_uio.in.h
664 lib/time.in.h 723 lib/time.in.h
665 lib/time_r.c 724 lib/time_r.c
666 lib/timegm.c 725 lib/timegm.c
667 lib/unistd--.h 726 lib/unistd.c
668 lib/unistd-safer.h
669 lib/unistd.in.h 727 lib/unistd.in.h
670 lib/unsetenv.c 728 lib/unsetenv.c
671 lib/vasnprintf.c 729 lib/vasnprintf.c
@@ -676,42 +734,38 @@ AC_DEFUN([gl_FILE_LIST], [
676 lib/w32sock.h 734 lib/w32sock.h
677 lib/wchar.in.h 735 lib/wchar.in.h
678 lib/wcrtomb.c 736 lib/wcrtomb.c
737 lib/wctype-h.c
679 lib/wctype.in.h 738 lib/wctype.in.h
680 lib/write.c
681 lib/xalloc-die.c 739 lib/xalloc-die.c
740 lib/xalloc-oversized.h
682 lib/xalloc.h 741 lib/xalloc.h
683 lib/xmalloc.c 742 lib/xmalloc.c
743 lib/xsize.c
684 lib/xsize.h 744 lib/xsize.h
685 lib/xstrndup.c 745 lib/xstrndup.c
686 lib/xstrndup.h 746 lib/xstrndup.h
687 m4/00gnulib.m4 747 m4/00gnulib.m4
688 m4/alloca.m4 748 m4/alloca.m4
689 m4/arpa_inet_h.m4 749 m4/arpa_inet_h.m4
690 m4/asm-underscore.m4
691 m4/base64.m4 750 m4/base64.m4
692 m4/btowc.m4 751 m4/btowc.m4
693 m4/c-strtod.m4
694 m4/cloexec.m4
695 m4/codeset.m4 752 m4/codeset.m4
753 m4/configmake.m4
696 m4/dirname.m4 754 m4/dirname.m4
697 m4/dos.m4
698 m4/double-slash-root.m4 755 m4/double-slash-root.m4
699 m4/dup2.m4
700 m4/eealloc.m4 756 m4/eealloc.m4
701 m4/environ.m4 757 m4/environ.m4
702 m4/errno_h.m4 758 m4/errno_h.m4
703 m4/error.m4 759 m4/error.m4
760 m4/exponentd.m4
704 m4/extensions.m4 761 m4/extensions.m4
762 m4/extern-inline.m4
705 m4/fcntl-o.m4 763 m4/fcntl-o.m4
706 m4/fcntl-safer.m4
707 m4/fcntl.m4
708 m4/fcntl_h.m4
709 m4/float_h.m4 764 m4/float_h.m4
710 m4/floorf.m4 765 m4/floorf.m4
711 m4/fstypename.m4 766 m4/fstypename.m4
712 m4/fsusage.m4 767 m4/fsusage.m4
713 m4/getaddrinfo.m4 768 m4/getaddrinfo.m4
714 m4/getdtablesize.m4
715 m4/gethostname.m4 769 m4/gethostname.m4
716 m4/getloadavg.m4 770 m4/getloadavg.m4
717 m4/getopt.m4 771 m4/getopt.m4
@@ -723,7 +777,6 @@ AC_DEFUN([gl_FILE_LIST], [
723 m4/iconv.m4 777 m4/iconv.m4
724 m4/include_next.m4 778 m4/include_next.m4
725 m4/inet_ntop.m4 779 m4/inet_ntop.m4
726 m4/inline.m4
727 m4/intdiv0.m4 780 m4/intdiv0.m4
728 m4/intl.m4 781 m4/intl.m4
729 m4/intldir.m4 782 m4/intldir.m4
@@ -733,6 +786,7 @@ AC_DEFUN([gl_FILE_LIST], [
733 m4/inttypes-pri.m4 786 m4/inttypes-pri.m4
734 m4/inttypes_h.m4 787 m4/inttypes_h.m4
735 m4/langinfo_h.m4 788 m4/langinfo_h.m4
789 m4/largefile.m4
736 m4/lcmessage.m4 790 m4/lcmessage.m4
737 m4/lib-ld.m4 791 m4/lib-ld.m4
738 m4/lib-link.m4 792 m4/lib-link.m4
@@ -742,6 +796,7 @@ AC_DEFUN([gl_FILE_LIST], [
742 m4/locale-ja.m4 796 m4/locale-ja.m4
743 m4/locale-zh.m4 797 m4/locale-zh.m4
744 m4/locale_h.m4 798 m4/locale_h.m4
799 m4/localeconv.m4
745 m4/lock.m4 800 m4/lock.m4
746 m4/longlong.m4 801 m4/longlong.m4
747 m4/ls-mntd-fs.m4 802 m4/ls-mntd-fs.m4
@@ -751,42 +806,45 @@ AC_DEFUN([gl_FILE_LIST], [
751 m4/mbrtowc.m4 806 m4/mbrtowc.m4
752 m4/mbsinit.m4 807 m4/mbsinit.m4
753 m4/mbstate_t.m4 808 m4/mbstate_t.m4
809 m4/mbtowc.m4
754 m4/memchr.m4 810 m4/memchr.m4
755 m4/mktime.m4 811 m4/mktime.m4
756 m4/mmap-anon.m4 812 m4/mmap-anon.m4
757 m4/mode_t.m4
758 m4/mountlist.m4 813 m4/mountlist.m4
814 m4/msvc-inval.m4
815 m4/msvc-nothrow.m4
759 m4/multiarch.m4 816 m4/multiarch.m4
760 m4/netdb_h.m4 817 m4/netdb_h.m4
761 m4/netinet_in_h.m4 818 m4/netinet_in_h.m4
762 m4/nl_langinfo.m4 819 m4/nl_langinfo.m4
763 m4/nls.m4 820 m4/nls.m4
821 m4/nocrash.m4
822 m4/off_t.m4
764 m4/onceonly.m4 823 m4/onceonly.m4
765 m4/open.m4
766 m4/po.m4 824 m4/po.m4
767 m4/printf-posix.m4 825 m4/printf-posix.m4
768 m4/printf.m4 826 m4/printf.m4
769 m4/progtest.m4 827 m4/progtest.m4
828 m4/read.m4
770 m4/regex.m4 829 m4/regex.m4
771 m4/safe-read.m4 830 m4/safe-read.m4
772 m4/safe-write.m4
773 m4/servent.m4 831 m4/servent.m4
774 m4/setenv.m4 832 m4/setenv.m4
775 m4/sha1.m4 833 m4/sha1.m4
776 m4/size_max.m4 834 m4/size_max.m4
777 m4/snprintf.m4 835 m4/snprintf.m4
836 m4/socketlib.m4
778 m4/sockets.m4 837 m4/sockets.m4
779 m4/socklen.m4 838 m4/socklen.m4
780 m4/sockpfaf.m4 839 m4/sockpfaf.m4
781 m4/ssize_t.m4 840 m4/ssize_t.m4
782 m4/stat.m4 841 m4/stdalign.m4
783 m4/stdbool.m4 842 m4/stdbool.m4
784 m4/stddef_h.m4 843 m4/stddef_h.m4
785 m4/stdint.m4 844 m4/stdint.m4
786 m4/stdint_h.m4 845 m4/stdint_h.m4
787 m4/stdio_h.m4 846 m4/stdio_h.m4
788 m4/stdlib_h.m4 847 m4/stdlib_h.m4
789 m4/strdup.m4
790 m4/strerror.m4 848 m4/strerror.m4
791 m4/string_h.m4 849 m4/string_h.m4
792 m4/strndup.m4 850 m4/strndup.m4
@@ -794,13 +852,13 @@ AC_DEFUN([gl_FILE_LIST], [
794 m4/strsep.m4 852 m4/strsep.m4
795 m4/strstr.m4 853 m4/strstr.m4
796 m4/sys_socket_h.m4 854 m4/sys_socket_h.m4
797 m4/sys_stat_h.m4 855 m4/sys_types_h.m4
856 m4/sys_uio_h.m4
798 m4/threadlib.m4 857 m4/threadlib.m4
799 m4/time_h.m4 858 m4/time_h.m4
800 m4/time_r.m4 859 m4/time_r.m4
801 m4/timegm.m4 860 m4/timegm.m4
802 m4/uintmax_t.m4 861 m4/uintmax_t.m4
803 m4/unistd-safer.m4
804 m4/unistd_h.m4 862 m4/unistd_h.m4
805 m4/vasnprintf.m4 863 m4/vasnprintf.m4
806 m4/vasprintf.m4 864 m4/vasprintf.m4
@@ -812,7 +870,6 @@ AC_DEFUN([gl_FILE_LIST], [
812 m4/wcrtomb.m4 870 m4/wcrtomb.m4
813 m4/wctype_h.m4 871 m4/wctype_h.m4
814 m4/wint_t.m4 872 m4/wint_t.m4
815 m4/write.m4
816 m4/xalloc.m4 873 m4/xalloc.m4
817 m4/xsize.m4 874 m4/xsize.m4
818 m4/xstrndup.m4 875 m4/xstrndup.m4
diff --git a/gl/m4/gnulib-tool.m4 b/gl/m4/gnulib-tool.m4
index 69e7733..f3dea1a 100644
--- a/gl/m4/gnulib-tool.m4
+++ b/gl/m4/gnulib-tool.m4
@@ -1,5 +1,5 @@
1# gnulib-tool.m4 serial 2 1# gnulib-tool.m4 serial 2
2dnl Copyright (C) 2004-2005, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2004-2005, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
diff --git a/gl/m4/hostent.m4 b/gl/m4/hostent.m4
index 1111041..72be876 100644
--- a/gl/m4/hostent.m4
+++ b/gl/m4/hostent.m4
@@ -1,5 +1,5 @@
1# hostent.m4 serial 1 1# hostent.m4 serial 2
2dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2008, 2010-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -28,12 +28,16 @@ AC_DEFUN([gl_HOSTENT],
28 [gl_cv_w32_gethostbyname=no 28 [gl_cv_w32_gethostbyname=no
29 gl_save_LIBS="$LIBS" 29 gl_save_LIBS="$LIBS"
30 LIBS="$LIBS -lws2_32" 30 LIBS="$LIBS -lws2_32"
31 AC_TRY_LINK([ 31 AC_LINK_IFELSE(
32 [AC_LANG_PROGRAM(
33 [[
32#ifdef HAVE_WINSOCK2_H 34#ifdef HAVE_WINSOCK2_H
33#include <winsock2.h> 35#include <winsock2.h>
34#endif 36#endif
35#include <stddef.h> 37#include <stddef.h>
36], [gethostbyname(NULL);], [gl_cv_w32_gethostbyname=yes]) 38 ]],
39 [[gethostbyname(NULL);]])],
40 [gl_cv_w32_gethostbyname=yes])
37 LIBS="$gl_save_LIBS" 41 LIBS="$gl_save_LIBS"
38 ]) 42 ])
39 if test "$gl_cv_w32_gethostbyname" = "yes"; then 43 if test "$gl_cv_w32_gethostbyname" = "yes"; then
diff --git a/gl/m4/iconv.m4 b/gl/m4/iconv.m4
index e2041b9..a503646 100644
--- a/gl/m4/iconv.m4
+++ b/gl/m4/iconv.m4
@@ -1,5 +1,5 @@
1# iconv.m4 serial 11 (gettext-0.18.1) 1# iconv.m4 serial 18 (gettext-0.18.2)
2dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2007-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -30,27 +30,35 @@ AC_DEFUN([AM_ICONV_LINK],
30 dnl Add $INCICONV to CPPFLAGS before performing the following checks, 30 dnl Add $INCICONV to CPPFLAGS before performing the following checks,
31 dnl because if the user has installed libiconv and not disabled its use 31 dnl because if the user has installed libiconv and not disabled its use
32 dnl via --without-libiconv-prefix, he wants to use it. The first 32 dnl via --without-libiconv-prefix, he wants to use it. The first
33 dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. 33 dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
34 am_save_CPPFLAGS="$CPPFLAGS" 34 am_save_CPPFLAGS="$CPPFLAGS"
35 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) 35 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
36 36
37 AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ 37 AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
38 am_cv_func_iconv="no, consider installing GNU libiconv" 38 am_cv_func_iconv="no, consider installing GNU libiconv"
39 am_cv_lib_iconv=no 39 am_cv_lib_iconv=no
40 AC_TRY_LINK([#include <stdlib.h> 40 AC_LINK_IFELSE(
41#include <iconv.h>], 41 [AC_LANG_PROGRAM(
42 [iconv_t cd = iconv_open("",""); 42 [[
43 iconv(cd,NULL,NULL,NULL,NULL); 43#include <stdlib.h>
44 iconv_close(cd);], 44#include <iconv.h>
45 ]],
46 [[iconv_t cd = iconv_open("","");
47 iconv(cd,NULL,NULL,NULL,NULL);
48 iconv_close(cd);]])],
45 [am_cv_func_iconv=yes]) 49 [am_cv_func_iconv=yes])
46 if test "$am_cv_func_iconv" != yes; then 50 if test "$am_cv_func_iconv" != yes; then
47 am_save_LIBS="$LIBS" 51 am_save_LIBS="$LIBS"
48 LIBS="$LIBS $LIBICONV" 52 LIBS="$LIBS $LIBICONV"
49 AC_TRY_LINK([#include <stdlib.h> 53 AC_LINK_IFELSE(
50#include <iconv.h>], 54 [AC_LANG_PROGRAM(
51 [iconv_t cd = iconv_open("",""); 55 [[
52 iconv(cd,NULL,NULL,NULL,NULL); 56#include <stdlib.h>
53 iconv_close(cd);], 57#include <iconv.h>
58 ]],
59 [[iconv_t cd = iconv_open("","");
60 iconv(cd,NULL,NULL,NULL,NULL);
61 iconv_close(cd);]])],
54 [am_cv_lib_iconv=yes] 62 [am_cv_lib_iconv=yes]
55 [am_cv_func_iconv=yes]) 63 [am_cv_func_iconv=yes])
56 LIBS="$am_save_LIBS" 64 LIBS="$am_save_LIBS"
@@ -58,16 +66,19 @@ AC_DEFUN([AM_ICONV_LINK],
58 ]) 66 ])
59 if test "$am_cv_func_iconv" = yes; then 67 if test "$am_cv_func_iconv" = yes; then
60 AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ 68 AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
61 dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10. 69 dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
70 dnl Solaris 10.
62 am_save_LIBS="$LIBS" 71 am_save_LIBS="$LIBS"
63 if test $am_cv_lib_iconv = yes; then 72 if test $am_cv_lib_iconv = yes; then
64 LIBS="$LIBS $LIBICONV" 73 LIBS="$LIBS $LIBICONV"
65 fi 74 fi
66 AC_TRY_RUN([ 75 AC_RUN_IFELSE(
76 [AC_LANG_SOURCE([[
67#include <iconv.h> 77#include <iconv.h>
68#include <string.h> 78#include <string.h>
69int main () 79int main ()
70{ 80{
81 int result = 0;
71 /* Test against AIX 5.1 bug: Failures are not distinguishable from successful 82 /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
72 returns. */ 83 returns. */
73 { 84 {
@@ -84,7 +95,8 @@ int main ()
84 (char **) &inptr, &inbytesleft, 95 (char **) &inptr, &inbytesleft,
85 &outptr, &outbytesleft); 96 &outptr, &outbytesleft);
86 if (res == 0) 97 if (res == 0)
87 return 1; 98 result |= 1;
99 iconv_close (cd_utf8_to_88591);
88 } 100 }
89 } 101 }
90 /* Test against Solaris 10 bug: Failures are not distinguishable from 102 /* Test against Solaris 10 bug: Failures are not distinguishable from
@@ -103,7 +115,27 @@ int main ()
103 (char **) &inptr, &inbytesleft, 115 (char **) &inptr, &inbytesleft,
104 &outptr, &outbytesleft); 116 &outptr, &outbytesleft);
105 if (res == 0) 117 if (res == 0)
106 return 1; 118 result |= 2;
119 iconv_close (cd_ascii_to_88591);
120 }
121 }
122 /* Test against AIX 6.1..7.1 bug: Buffer overrun. */
123 {
124 iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
125 if (cd_88591_to_utf8 != (iconv_t)(-1))
126 {
127 static const char input[] = "\304";
128 static char buf[2] = { (char)0xDE, (char)0xAD };
129 const char *inptr = input;
130 size_t inbytesleft = 1;
131 char *outptr = buf;
132 size_t outbytesleft = 1;
133 size_t res = iconv (cd_88591_to_utf8,
134 (char **) &inptr, &inbytesleft,
135 &outptr, &outbytesleft);
136 if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
137 result |= 4;
138 iconv_close (cd_88591_to_utf8);
107 } 139 }
108 } 140 }
109#if 0 /* This bug could be worked around by the caller. */ 141#if 0 /* This bug could be worked around by the caller. */
@@ -122,7 +154,8 @@ int main ()
122 (char **) &inptr, &inbytesleft, 154 (char **) &inptr, &inbytesleft,
123 &outptr, &outbytesleft); 155 &outptr, &outbytesleft);
124 if ((int)res > 0) 156 if ((int)res > 0)
125 return 1; 157 result |= 8;
158 iconv_close (cd_88591_to_utf8);
126 } 159 }
127 } 160 }
128#endif 161#endif
@@ -136,13 +169,19 @@ int main ()
136 && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) 169 && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
137 /* Try HP-UX names. */ 170 /* Try HP-UX names. */
138 && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) 171 && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
139 return 1; 172 result |= 16;
140 return 0; 173 return result;
141}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no], 174}]])],
142 [case "$host_os" in 175 [am_cv_func_iconv_works=yes],
176 [am_cv_func_iconv_works=no],
177 [
178changequote(,)dnl
179 case "$host_os" in
143 aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; 180 aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
144 *) am_cv_func_iconv_works="guessing yes" ;; 181 *) am_cv_func_iconv_works="guessing yes" ;;
145 esac]) 182 esac
183changequote([,])dnl
184 ])
146 LIBS="$am_save_LIBS" 185 LIBS="$am_save_LIBS"
147 ]) 186 ])
148 case "$am_cv_func_iconv_works" in 187 case "$am_cv_func_iconv_works" in
@@ -183,32 +222,47 @@ m4_define([gl_iconv_AC_DEFUN],
183 m4_version_prereq([2.64], 222 m4_version_prereq([2.64],
184 [[AC_DEFUN_ONCE( 223 [[AC_DEFUN_ONCE(
185 [$1], [$2])]], 224 [$1], [$2])]],
186 [[AC_DEFUN( 225 [m4_ifdef([gl_00GNULIB],
187 [$1], [$2])]])) 226 [[AC_DEFUN_ONCE(
227 [$1], [$2])]],
228 [[AC_DEFUN(
229 [$1], [$2])]])]))
188gl_iconv_AC_DEFUN([AM_ICONV], 230gl_iconv_AC_DEFUN([AM_ICONV],
189[ 231[
190 AM_ICONV_LINK 232 AM_ICONV_LINK
191 if test "$am_cv_func_iconv" = yes; then 233 if test "$am_cv_func_iconv" = yes; then
192 AC_MSG_CHECKING([for iconv declaration]) 234 AC_MSG_CHECKING([for iconv declaration])
193 AC_CACHE_VAL([am_cv_proto_iconv], [ 235 AC_CACHE_VAL([am_cv_proto_iconv], [
194 AC_TRY_COMPILE([ 236 AC_COMPILE_IFELSE(
237 [AC_LANG_PROGRAM(
238 [[
195#include <stdlib.h> 239#include <stdlib.h>
196#include <iconv.h> 240#include <iconv.h>
197extern 241extern
198#ifdef __cplusplus 242#ifdef __cplusplus
199"C" 243"C"
200#endif 244#endif
201#if defined(__STDC__) || defined(__cplusplus) 245#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
202size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); 246size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
203#else 247#else
204size_t iconv(); 248size_t iconv();
205#endif 249#endif
206], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"]) 250 ]],
251 [[]])],
252 [am_cv_proto_iconv_arg1=""],
253 [am_cv_proto_iconv_arg1="const"])
207 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) 254 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
208 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` 255 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
209 AC_MSG_RESULT([ 256 AC_MSG_RESULT([
210 $am_cv_proto_iconv]) 257 $am_cv_proto_iconv])
211 AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], 258 AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
212 [Define as const if the declaration of iconv() needs const.]) 259 [Define as const if the declaration of iconv() needs const.])
260 dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
261 m4_ifdef([gl_ICONV_H_DEFAULTS],
262 [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
263 if test -n "$am_cv_proto_iconv_arg1"; then
264 ICONV_CONST="const"
265 fi
266 ])
213 fi 267 fi
214]) 268])
diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4
index c7e0672..108d945 100644
--- a/gl/m4/include_next.m4
+++ b/gl/m4/include_next.m4
@@ -1,5 +1,5 @@
1# include_next.m4 serial 14 1# include_next.m4 serial 23
2dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2006-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -24,6 +24,13 @@ dnl does not warn about some things, and on some systems (Solaris and Interix)
24dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side 24dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side
25dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead 25dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead
26dnl of plain '__STDC__'. 26dnl of plain '__STDC__'.
27dnl
28dnl PRAGMA_COLUMNS can be used in files that override system header files, so
29dnl as to avoid compilation errors on HP NonStop systems when the gnulib file
30dnl is included by a system header file that does a "#pragma COLUMNS 80" (which
31dnl has the effect of truncating the lines of that file and all files that it
32dnl includes to 80 columns) and the gnulib file has lines longer than 80
33dnl columns.
27 34
28AC_DEFUN([gl_INCLUDE_NEXT], 35AC_DEFUN([gl_INCLUDE_NEXT],
29[ 36[
@@ -68,10 +75,11 @@ EOF
68EOF 75EOF
69 gl_save_CPPFLAGS="$CPPFLAGS" 76 gl_save_CPPFLAGS="$CPPFLAGS"
70 CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" 77 CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2"
71 AC_COMPILE_IFELSE([#include <conftest.h>], 78dnl We intentionally avoid using AC_LANG_SOURCE here.
79 AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]],
72 [gl_cv_have_include_next=yes], 80 [gl_cv_have_include_next=yes],
73 [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" 81 [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2"
74 AC_COMPILE_IFELSE([#include <conftest.h>], 82 AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]],
75 [gl_cv_have_include_next=buggy], 83 [gl_cv_have_include_next=buggy],
76 [gl_cv_have_include_next=no]) 84 [gl_cv_have_include_next=no])
77 ]) 85 ])
@@ -97,6 +105,24 @@ EOF
97 AC_SUBST([INCLUDE_NEXT]) 105 AC_SUBST([INCLUDE_NEXT])
98 AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE]) 106 AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE])
99 AC_SUBST([PRAGMA_SYSTEM_HEADER]) 107 AC_SUBST([PRAGMA_SYSTEM_HEADER])
108 AC_CACHE_CHECK([whether system header files limit the line length],
109 [gl_cv_pragma_columns],
110 [dnl HP NonStop systems, which define __TANDEM, have this misfeature.
111 AC_EGREP_CPP([choke me],
112 [
113#ifdef __TANDEM
114choke me
115#endif
116 ],
117 [gl_cv_pragma_columns=yes],
118 [gl_cv_pragma_columns=no])
119 ])
120 if test $gl_cv_pragma_columns = yes; then
121 PRAGMA_COLUMNS="#pragma COLUMNS 10000"
122 else
123 PRAGMA_COLUMNS=
124 fi
125 AC_SUBST([PRAGMA_COLUMNS])
100]) 126])
101 127
102# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...) 128# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
@@ -117,71 +143,128 @@ EOF
117# even if the compiler does not support include_next. 143# even if the compiler does not support include_next.
118# The three "///" are to pacify Sun C 5.8, which otherwise would say 144# The three "///" are to pacify Sun C 5.8, which otherwise would say
119# "warning: #include of /usr/include/... may be non-portable". 145# "warning: #include of /usr/include/... may be non-portable".
120# Use `""', not `<>', so that the /// cannot be confused with a C99 comment. 146# Use '""', not '<>', so that the /// cannot be confused with a C99 comment.
121# Note: This macro assumes that the header file is not empty after 147# Note: This macro assumes that the header file is not empty after
122# preprocessing, i.e. it does not only define preprocessor macros but also 148# preprocessing, i.e. it does not only define preprocessor macros but also
123# provides some type/enum definitions or function/variable declarations. 149# provides some type/enum definitions or function/variable declarations.
150#
151# This macro also checks whether each header exists, by invoking
152# AC_CHECK_HEADERS_ONCE or AC_CHECK_HEADERS on each argument.
124AC_DEFUN([gl_CHECK_NEXT_HEADERS], 153AC_DEFUN([gl_CHECK_NEXT_HEADERS],
125[ 154[
155 gl_NEXT_HEADERS_INTERNAL([$1], [check])
156])
157
158# gl_NEXT_HEADERS(HEADER1 HEADER2 ...)
159# ------------------------------------
160# Like gl_CHECK_NEXT_HEADERS, except do not check whether the headers exist.
161# This is suitable for headers like <stddef.h> that are standardized by C89
162# and therefore can be assumed to exist.
163AC_DEFUN([gl_NEXT_HEADERS],
164[
165 gl_NEXT_HEADERS_INTERNAL([$1], [assume])
166])
167
168# The guts of gl_CHECK_NEXT_HEADERS and gl_NEXT_HEADERS.
169AC_DEFUN([gl_NEXT_HEADERS_INTERNAL],
170[
126 AC_REQUIRE([gl_INCLUDE_NEXT]) 171 AC_REQUIRE([gl_INCLUDE_NEXT])
127 AC_REQUIRE([AC_CANONICAL_HOST]) 172 AC_REQUIRE([AC_CANONICAL_HOST])
128 AC_CHECK_HEADERS_ONCE([$1])
129 173
174 m4_if([$2], [check],
175 [AC_CHECK_HEADERS_ONCE([$1])
176 ])
177
178dnl FIXME: gl_next_header and gl_header_exists must be used unquoted
179dnl until we can assume autoconf 2.64 or newer.
130 m4_foreach_w([gl_HEADER_NAME], [$1], 180 m4_foreach_w([gl_HEADER_NAME], [$1],
131 [AS_VAR_PUSHDEF([gl_next_header], 181 [AS_VAR_PUSHDEF([gl_next_header],
132 [gl_cv_next_]m4_defn([gl_HEADER_NAME])) 182 [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
133 if test $gl_cv_have_include_next = yes; then 183 if test $gl_cv_have_include_next = yes; then
134 AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) 184 AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>'])
135 else 185 else
136 AC_CACHE_CHECK( 186 AC_CACHE_CHECK(
137 [absolute name of <]m4_defn([gl_HEADER_NAME])[>], 187 [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
138 m4_defn([gl_next_header]), 188 m4_defn([gl_next_header]),
139 [AS_VAR_PUSHDEF([gl_header_exists], 189 [m4_if([$2], [check],
140 [ac_cv_header_]m4_defn([gl_HEADER_NAME])) 190 [AS_VAR_PUSHDEF([gl_header_exists],
141 if test AS_VAR_GET(gl_header_exists) = yes; then 191 [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
142 AC_LANG_CONFTEST( 192 if test AS_VAR_GET(gl_header_exists) = yes; then
143 [AC_LANG_SOURCE( 193 AS_VAR_POPDEF([gl_header_exists])
144 [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] 194 ])
145 )]) 195 AC_LANG_CONFTEST(
146 dnl AIX "xlc -E" and "cc -E" omit #line directives for header files 196 [AC_LANG_SOURCE(
147 dnl that contain only a #include of other header files and no 197 [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
148 dnl non-comment tokens of their own. This leads to a failure to 198 )])
149 dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h> 199 dnl AIX "xlc -E" and "cc -E" omit #line directives for header
150 dnl and others. The workaround is to force preservation of comments 200 dnl files that contain only a #include of other header files and
151 dnl through option -C. This ensures all necessary #line directives 201 dnl no non-comment tokens of their own. This leads to a failure
152 dnl are present. GCC supports option -C as well. 202 dnl to detect the absolute name of <dirent.h>, <signal.h>,
153 case "$host_os" in 203 dnl <poll.h> and others. The workaround is to force preservation
154 aix*) gl_absname_cpp="$ac_cpp -C" ;; 204 dnl of comments through option -C. This ensures all necessary
155 *) gl_absname_cpp="$ac_cpp" ;; 205 dnl #line directives are present. GCC supports option -C as well.
156 esac 206 case "$host_os" in
157 dnl eval is necessary to expand gl_absname_cpp. 207 aix*) gl_absname_cpp="$ac_cpp -C" ;;
158 dnl Ultrix and Pyramid sh refuse to redirect output of eval, 208 *) gl_absname_cpp="$ac_cpp" ;;
159 dnl so use subshell. 209 esac
160 AS_VAR_SET([gl_next_header], 210changequote(,)
161 ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | 211 case "$host_os" in
162 sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{ 212 mingw*)
163 s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1# 213 dnl For the sake of native Windows compilers (excluding gcc),
164 s#^/[^/]#//&# 214 dnl treat backslash as a directory separator, like /.
165 p 215 dnl Actually, these compilers use a double-backslash as
166 q 216 dnl directory separator, inside the
167 }'`'"']) 217 dnl # line "filename"
168 else 218 dnl directives.
169 AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) 219 gl_dirsep_regex='[/\\]'
170 fi 220 ;;
171 AS_VAR_POPDEF([gl_header_exists])]) 221 *)
222 gl_dirsep_regex='\/'
223 ;;
224 esac
225 dnl A sed expression that turns a string into a basic regular
226 dnl expression, for use within "/.../".
227 gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
228changequote([,])
229 gl_header_literal_regex=`echo ']m4_defn([gl_HEADER_NAME])[' \
230 | sed -e "$gl_make_literal_regex_sed"`
231 gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
232 s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
233changequote(,)dnl
234 s|^/[^/]|//&|
235changequote([,])dnl
236 p
237 q
238 }'
239 dnl eval is necessary to expand gl_absname_cpp.
240 dnl Ultrix and Pyramid sh refuse to redirect output of eval,
241 dnl so use subshell.
242 AS_VAR_SET(gl_next_header,
243 ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
244 sed -n "$gl_absolute_header_sed"`'"'])
245 m4_if([$2], [check],
246 [else
247 AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>'])
248 fi
249 ])
250 ])
172 fi 251 fi
173 AC_SUBST( 252 AC_SUBST(
174 AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])), 253 AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
175 [AS_VAR_GET([gl_next_header])]) 254 [AS_VAR_GET(gl_next_header)])
176 if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then 255 if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
177 # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' 256 # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
178 gl_next_as_first_directive='<'gl_HEADER_NAME'>' 257 gl_next_as_first_directive='<'gl_HEADER_NAME'>'
179 else 258 else
180 # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' 259 # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
181 gl_next_as_first_directive=AS_VAR_GET([gl_next_header]) 260 gl_next_as_first_directive=AS_VAR_GET(gl_next_header)
182 fi 261 fi
183 AC_SUBST( 262 AC_SUBST(
184 AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])), 263 AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])),
185 [$gl_next_as_first_directive]) 264 [$gl_next_as_first_directive])
186 AS_VAR_POPDEF([gl_next_header])]) 265 AS_VAR_POPDEF([gl_next_header])])
187]) 266])
267
268# Autoconf 2.68 added warnings for our use of AC_COMPILE_IFELSE;
269# this fallback is safe for all earlier autoconf versions.
270m4_define_default([AC_LANG_DEFINES_PROVIDED])
diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4
index a6d219c..476f063 100644
--- a/gl/m4/inet_ntop.m4
+++ b/gl/m4/inet_ntop.m4
@@ -1,38 +1,68 @@
1# inet_ntop.m4 serial 12 1# inet_ntop.m4 serial 19
2dnl Copyright (C) 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7AC_DEFUN([gl_FUNC_INET_NTOP], 7AC_DEFUN([gl_FUNC_INET_NTOP],
8[ 8[
9 AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
10
9 dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop. 11 dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop.
10 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 12 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
11 13
12 gl_REPLACE_ARPA_INET_H 14 AC_REQUIRE([AC_C_RESTRICT])
13 15
14 dnl Most platforms that provide inet_ntop define it in libc. 16 dnl Most platforms that provide inet_ntop define it in libc.
15 dnl Solaris 8..10 provide inet_ntop in libnsl instead. 17 dnl Solaris 8..10 provide inet_ntop in libnsl instead.
16 gl_save_LIBS=$LIBS 18 dnl Solaris 2.6..7 provide inet_ntop in libresolv instead.
17 AC_SEARCH_LIBS([inet_ntop], [nsl], [], 19 dnl Native Windows provides it in -lws2_32 instead, with a declaration in
18 [AC_REPLACE_FUNCS([inet_ntop])]) 20 dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl
19 LIBS=$gl_save_LIBS 21 dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it).
22 HAVE_INET_NTOP=1
20 INET_NTOP_LIB= 23 INET_NTOP_LIB=
21 if test "$ac_cv_search_inet_ntop" != "no" && 24 gl_PREREQ_SYS_H_WINSOCK2
22 test "$ac_cv_search_inet_ntop" != "none required"; then 25 if test $HAVE_WINSOCK2_H = 1; then
23 INET_NTOP_LIB="$ac_cv_search_inet_ntop" 26 AC_CHECK_DECLS([inet_ntop],,, [[#include <ws2tcpip.h>]])
27 if test $ac_cv_have_decl_inet_ntop = yes; then
28 dnl It needs to be overridden, because the stdcall calling convention
29 dnl is not compliant with POSIX.
30 REPLACE_INET_NTOP=1
31 INET_NTOP_LIB="-lws2_32"
32 else
33 HAVE_DECL_INET_NTOP=0
34 HAVE_INET_NTOP=0
35 fi
36 else
37 gl_save_LIBS=$LIBS
38 AC_SEARCH_LIBS([inet_ntop], [nsl resolv], [],
39 [AC_CHECK_FUNCS([inet_ntop])
40 if test $ac_cv_func_inet_ntop = no; then
41 HAVE_INET_NTOP=0
42 fi
43 ])
44 LIBS=$gl_save_LIBS
45
46 if test "$ac_cv_search_inet_ntop" != "no" \
47 && test "$ac_cv_search_inet_ntop" != "none required"; then
48 INET_NTOP_LIB="$ac_cv_search_inet_ntop"
49 fi
50
51 AC_CHECK_HEADERS_ONCE([netdb.h])
52 AC_CHECK_DECLS([inet_ntop],,,
53 [[#include <arpa/inet.h>
54 #if HAVE_NETDB_H
55 # include <netdb.h>
56 #endif
57 ]])
58 if test $ac_cv_have_decl_inet_ntop = no; then
59 HAVE_DECL_INET_NTOP=0
60 fi
24 fi 61 fi
25 AC_SUBST([INET_NTOP_LIB]) 62 AC_SUBST([INET_NTOP_LIB])
26
27 gl_PREREQ_INET_NTOP
28]) 63])
29 64
30# Prerequisites of lib/inet_ntop.c. 65# Prerequisites of lib/inet_ntop.c.
31AC_DEFUN([gl_PREREQ_INET_NTOP], [ 66AC_DEFUN([gl_PREREQ_INET_NTOP], [
32 AC_CHECK_DECLS([inet_ntop],,,[#include <arpa/inet.h>])
33 if test $ac_cv_have_decl_inet_ntop = no; then
34 HAVE_DECL_INET_NTOP=0
35 fi
36 AC_REQUIRE([gl_SOCKET_FAMILIES]) 67 AC_REQUIRE([gl_SOCKET_FAMILIES])
37 AC_REQUIRE([AC_C_RESTRICT])
38]) 68])
diff --git a/gl/m4/inline.m4 b/gl/m4/inline.m4
deleted file mode 100644
index 4ef768d..0000000
--- a/gl/m4/inline.m4
+++ /dev/null
@@ -1,40 +0,0 @@
1# inline.m4 serial 4
2dnl Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl Test for the 'inline' keyword or equivalent.
8dnl Define 'inline' to a supported equivalent, or to nothing if not supported,
9dnl like AC_C_INLINE does. Also, define HAVE_INLINE if 'inline' or an
10dnl equivalent is effectively supported, i.e. if the compiler is likely to
11dnl drop unused 'static inline' functions.
12AC_DEFUN([gl_INLINE],
13[
14 AC_REQUIRE([AC_C_INLINE])
15 AC_CACHE_CHECK([whether the compiler generally respects inline],
16 [gl_cv_c_inline_effective],
17 [if test $ac_cv_c_inline = no; then
18 gl_cv_c_inline_effective=no
19 else
20 dnl GCC defines __NO_INLINE__ if not optimizing or if -fno-inline is
21 dnl specified.
22 dnl Use AC_COMPILE_IFELSE here, not AC_EGREP_CPP, because the result
23 dnl depends on optimization flags, which can be in CFLAGS.
24 dnl (AC_EGREP_CPP looks only at the CPPFLAGS.)
25 AC_COMPILE_IFELSE(
26 [AC_LANG_PROGRAM([[]],
27 [[#ifdef __NO_INLINE__
28 #error "inline is not effective"
29 #endif]])],
30 [gl_cv_c_inline_effective=yes],
31 [gl_cv_c_inline_effective=no])
32 fi
33 ])
34 if test $gl_cv_c_inline_effective = yes; then
35 AC_DEFINE([HAVE_INLINE], [1],
36 [Define to 1 if the compiler supports one of the keywords
37 'inline', '__inline__', '__inline' and effectively inlines
38 functions marked as such.])
39 fi
40])
diff --git a/gl/m4/intdiv0.m4 b/gl/m4/intdiv0.m4
index 289c4df..74d0e80 100644
--- a/gl/m4/intdiv0.m4
+++ b/gl/m4/intdiv0.m4
@@ -1,5 +1,5 @@
1# intdiv0.m4 serial 3 (gettext-0.18) 1# intdiv0.m4 serial 6 (gettext-0.18.2)
2dnl Copyright (C) 2002, 2007-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2007-2008, 2010-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -18,7 +18,7 @@ AC_DEFUN([gt_INTDIV0],
18changequote(,)dnl 18changequote(,)dnl
19 case "$host_os" in 19 case "$host_os" in
20 macos* | darwin[6-9]* | darwin[1-9][0-9]*) 20 macos* | darwin[6-9]* | darwin[1-9][0-9]*)
21 # On MacOS X 10.2 or newer, just assume the same as when cross- 21 # On Mac OS X 10.2 or newer, just assume the same as when cross-
22 # compiling. If we were to perform the real test, 1 Crash Report 22 # compiling. If we were to perform the real test, 1 Crash Report
23 # dialog window would pop up. 23 # dialog window would pop up.
24 case "$host_cpu" in 24 case "$host_cpu" in
@@ -29,7 +29,8 @@ changequote(,)dnl
29 esac 29 esac
30changequote([,])dnl 30changequote([,])dnl
31 if test -z "$gt_cv_int_divbyzero_sigfpe"; then 31 if test -z "$gt_cv_int_divbyzero_sigfpe"; then
32 AC_TRY_RUN([ 32 AC_RUN_IFELSE(
33 [AC_LANG_SOURCE([[
33#include <stdlib.h> 34#include <stdlib.h>
34#include <signal.h> 35#include <signal.h>
35 36
@@ -59,9 +60,11 @@ int main ()
59 60
60 z = x / y; 61 z = x / y;
61 nan = y / y; 62 nan = y / y;
62 exit (1); 63 exit (2);
63} 64}
64], [gt_cv_int_divbyzero_sigfpe=yes], [gt_cv_int_divbyzero_sigfpe=no], 65]])],
66 [gt_cv_int_divbyzero_sigfpe=yes],
67 [gt_cv_int_divbyzero_sigfpe=no],
65 [ 68 [
66 # Guess based on the CPU. 69 # Guess based on the CPU.
67changequote(,)dnl 70changequote(,)dnl
diff --git a/gl/m4/intl.m4 b/gl/m4/intl.m4
index 335b23c..959bd04 100644
--- a/gl/m4/intl.m4
+++ b/gl/m4/intl.m4
@@ -1,5 +1,5 @@
1# intl.m4 serial 17 (gettext-0.18) 1# intl.m4 serial 23 (gettext-0.18.3)
2dnl Copyright (C) 1995-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 1995-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -17,7 +17,7 @@ dnl Authors:
17dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. 17dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18dnl Bruno Haible <haible@clisp.cons.org>, 2000-2009. 18dnl Bruno Haible <haible@clisp.cons.org>, 2000-2009.
19 19
20AC_PREREQ([2.52]) 20AC_PREREQ([2.60])
21 21
22dnl Checks for all prerequisites of the intl subdirectory, 22dnl Checks for all prerequisites of the intl subdirectory,
23dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, 23dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
@@ -25,7 +25,7 @@ dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
25AC_DEFUN([AM_INTL_SUBDIR], 25AC_DEFUN([AM_INTL_SUBDIR],
26[ 26[
27 AC_REQUIRE([AC_PROG_INSTALL])dnl 27 AC_REQUIRE([AC_PROG_INSTALL])dnl
28 AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake 28 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
29 AC_REQUIRE([AC_PROG_CC])dnl 29 AC_REQUIRE([AC_PROG_CC])dnl
30 AC_REQUIRE([AC_CANONICAL_HOST])dnl 30 AC_REQUIRE([AC_CANONICAL_HOST])dnl
31 AC_REQUIRE([gt_GLIBC2])dnl 31 AC_REQUIRE([gt_GLIBC2])dnl
@@ -55,21 +55,19 @@ AC_DEFUN([AM_INTL_SUBDIR],
55 [AC_DEFINE([ptrdiff_t], [long], 55 [AC_DEFINE([ptrdiff_t], [long],
56 [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) 56 [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
57 ]) 57 ])
58 AC_CHECK_HEADERS([stddef.h stdlib.h string.h]) 58 AC_CHECK_HEADERS([features.h stddef.h stdlib.h string.h])
59 AC_CHECK_FUNCS([asprintf fwprintf newlocale putenv setenv setlocale \ 59 AC_CHECK_FUNCS([asprintf fwprintf newlocale putenv setenv setlocale \
60 snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) 60 snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb])
61 61
62 dnl Use the _snprintf function only if it is declared (because on NetBSD it 62 dnl Use the _snprintf function only if it is declared (because on NetBSD it
63 dnl is defined as a weak alias of snprintf; we prefer to use the latter). 63 dnl is defined as a weak alias of snprintf; we prefer to use the latter).
64 gt_CHECK_DECL(_snprintf, [#include <stdio.h>]) 64 AC_CHECK_DECLS([_snprintf _snwprintf], , , [#include <stdio.h>])
65 gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
66 65
67 dnl Use the *_unlocked functions only if they are declared. 66 dnl Use the *_unlocked functions only if they are declared.
68 dnl (because some of them were defined without being declared in Solaris 67 dnl (because some of them were defined without being declared in Solaris
69 dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built 68 dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
70 dnl on Solaris 2.5.1 to run on Solaris 2.6). 69 dnl on Solaris 2.5.1 to run on Solaris 2.6).
71 dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. 70 AC_CHECK_DECLS([getc_unlocked], , , [#include <stdio.h>])
72 gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
73 71
74 case $gt_cv_func_printf_posix in 72 case $gt_cv_func_printf_posix in
75 *yes) HAVE_POSIX_PRINTF=1 ;; 73 *yes) HAVE_POSIX_PRINTF=1 ;;
@@ -220,9 +218,10 @@ AC_DEFUN([gt_INTL_SUBDIR_CORE],
220 AC_REQUIRE([gt_INTTYPES_PRI])dnl 218 AC_REQUIRE([gt_INTTYPES_PRI])dnl
221 AC_REQUIRE([gl_LOCK])dnl 219 AC_REQUIRE([gl_LOCK])dnl
222 220
223 AC_TRY_LINK( 221 AC_LINK_IFELSE(
224 [int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }], 222 [AC_LANG_PROGRAM(
225 [], 223 [[int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }]],
224 [[]])],
226 [AC_DEFINE([HAVE_BUILTIN_EXPECT], [1], 225 [AC_DEFINE([HAVE_BUILTIN_EXPECT], [1],
227 [Define to 1 if the compiler understands __builtin_expect.])]) 226 [Define to 1 if the compiler understands __builtin_expect.])])
228 227
@@ -235,9 +234,7 @@ AC_DEFUN([gt_INTL_SUBDIR_CORE],
235 dnl (because some of them were defined without being declared in Solaris 234 dnl (because some of them were defined without being declared in Solaris
236 dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built 235 dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
237 dnl on Solaris 2.5.1 to run on Solaris 2.6). 236 dnl on Solaris 2.5.1 to run on Solaris 2.6).
238 dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. 237 AC_CHECK_DECLS([feof_unlocked fgets_unlocked], , , [#include <stdio.h>])
239 gt_CHECK_DECL([feof_unlocked], [#include <stdio.h>])
240 gt_CHECK_DECL([fgets_unlocked], [#include <stdio.h>])
241 238
242 AM_ICONV 239 AM_ICONV
243 240
@@ -272,23 +269,3 @@ changequote([,])dnl
272 INTLBISON=: 269 INTLBISON=:
273 fi 270 fi
274]) 271])
275
276
277dnl gt_CHECK_DECL(FUNC, INCLUDES)
278dnl Check whether a function is declared.
279AC_DEFUN([gt_CHECK_DECL],
280[
281 AC_CACHE_CHECK([whether $1 is declared], [ac_cv_have_decl_$1],
282 [AC_TRY_COMPILE([$2], [
283#ifndef $1
284 char *p = (char *) $1;
285#endif
286], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
287 if test $ac_cv_have_decl_$1 = yes; then
288 gt_value=1
289 else
290 gt_value=0
291 fi
292 AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
293 [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
294])
diff --git a/gl/m4/intldir.m4 b/gl/m4/intldir.m4
index ebae76d..388ecd6 100644
--- a/gl/m4/intldir.m4
+++ b/gl/m4/intldir.m4
@@ -1,5 +1,5 @@
1# intldir.m4 serial 2 (gettext-0.18) 1# intldir.m4 serial 2 (gettext-0.18)
2dnl Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
diff --git a/gl/m4/intlmacosx.m4 b/gl/m4/intlmacosx.m4
index dd91025..ab97d39 100644
--- a/gl/m4/intlmacosx.m4
+++ b/gl/m4/intlmacosx.m4
@@ -1,5 +1,5 @@
1# intlmacosx.m4 serial 3 (gettext-0.18) 1# intlmacosx.m4 serial 5 (gettext-0.18.2)
2dnl Copyright (C) 2004-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2004-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -13,35 +13,40 @@ dnl by the GNU Library General Public License, and the rest of the GNU
13dnl gettext package package is covered by the GNU General Public License. 13dnl gettext package package is covered by the GNU General Public License.
14dnl They are *not* in the public domain. 14dnl They are *not* in the public domain.
15 15
16dnl Checks for special options needed on MacOS X. 16dnl Checks for special options needed on Mac OS X.
17dnl Defines INTL_MACOSX_LIBS. 17dnl Defines INTL_MACOSX_LIBS.
18AC_DEFUN([gt_INTL_MACOSX], 18AC_DEFUN([gt_INTL_MACOSX],
19[ 19[
20 dnl Check for API introduced in MacOS X 10.2. 20 dnl Check for API introduced in Mac OS X 10.2.
21 AC_CACHE_CHECK([for CFPreferencesCopyAppValue], 21 AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
22 [gt_cv_func_CFPreferencesCopyAppValue], 22 [gt_cv_func_CFPreferencesCopyAppValue],
23 [gt_save_LIBS="$LIBS" 23 [gt_save_LIBS="$LIBS"
24 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" 24 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
25 AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>], 25 AC_LINK_IFELSE(
26 [CFPreferencesCopyAppValue(NULL, NULL)], 26 [AC_LANG_PROGRAM(
27 [[#include <CoreFoundation/CFPreferences.h>]],
28 [[CFPreferencesCopyAppValue(NULL, NULL)]])],
27 [gt_cv_func_CFPreferencesCopyAppValue=yes], 29 [gt_cv_func_CFPreferencesCopyAppValue=yes],
28 [gt_cv_func_CFPreferencesCopyAppValue=no]) 30 [gt_cv_func_CFPreferencesCopyAppValue=no])
29 LIBS="$gt_save_LIBS"]) 31 LIBS="$gt_save_LIBS"])
30 if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then 32 if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
31 AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1], 33 AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
32 [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) 34 [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
33 fi 35 fi
34 dnl Check for API introduced in MacOS X 10.3. 36 dnl Check for API introduced in Mac OS X 10.3.
35 AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent], 37 AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent],
36 [gt_save_LIBS="$LIBS" 38 [gt_save_LIBS="$LIBS"
37 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" 39 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
38 AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();], 40 AC_LINK_IFELSE(
41 [AC_LANG_PROGRAM(
42 [[#include <CoreFoundation/CFLocale.h>]],
43 [[CFLocaleCopyCurrent();]])],
39 [gt_cv_func_CFLocaleCopyCurrent=yes], 44 [gt_cv_func_CFLocaleCopyCurrent=yes],
40 [gt_cv_func_CFLocaleCopyCurrent=no]) 45 [gt_cv_func_CFLocaleCopyCurrent=no])
41 LIBS="$gt_save_LIBS"]) 46 LIBS="$gt_save_LIBS"])
42 if test $gt_cv_func_CFLocaleCopyCurrent = yes; then 47 if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
43 AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1], 48 AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1],
44 [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) 49 [Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
45 fi 50 fi
46 INTL_MACOSX_LIBS= 51 INTL_MACOSX_LIBS=
47 if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then 52 if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
diff --git a/gl/m4/intmax.m4 b/gl/m4/intmax.m4
index 74aaaf5..18733a5 100644
--- a/gl/m4/intmax.m4
+++ b/gl/m4/intmax.m4
@@ -1,5 +1,5 @@
1# intmax.m4 serial 5 (gettext-0.18) 1# intmax.m4 serial 6 (gettext-0.18.2)
2dnl Copyright (C) 2002-2005, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2005, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -13,7 +13,9 @@ AC_DEFUN([gt_TYPE_INTMAX_T],
13 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) 13 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
14 AC_REQUIRE([gl_AC_HEADER_STDINT_H]) 14 AC_REQUIRE([gl_AC_HEADER_STDINT_H])
15 AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t], 15 AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t],
16 [AC_TRY_COMPILE([ 16 [AC_COMPILE_IFELSE(
17 [AC_LANG_PROGRAM(
18 [[
17#include <stddef.h> 19#include <stddef.h>
18#include <stdlib.h> 20#include <stdlib.h>
19#if HAVE_STDINT_H_WITH_UINTMAX 21#if HAVE_STDINT_H_WITH_UINTMAX
@@ -22,8 +24,9 @@ AC_DEFUN([gt_TYPE_INTMAX_T],
22#if HAVE_INTTYPES_H_WITH_UINTMAX 24#if HAVE_INTTYPES_H_WITH_UINTMAX
23#include <inttypes.h> 25#include <inttypes.h>
24#endif 26#endif
25], [intmax_t x = -1; 27 ]],
26 return !x;], 28 [[intmax_t x = -1;
29 return !x;]])],
27 [gt_cv_c_intmax_t=yes], 30 [gt_cv_c_intmax_t=yes],
28 [gt_cv_c_intmax_t=no])]) 31 [gt_cv_c_intmax_t=no])])
29 if test $gt_cv_c_intmax_t = yes; then 32 if test $gt_cv_c_intmax_t = yes; then
diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4
index 975caac..6ea7053 100644
--- a/gl/m4/intmax_t.m4
+++ b/gl/m4/intmax_t.m4
@@ -1,5 +1,5 @@
1# intmax_t.m4 serial 7 1# intmax_t.m4 serial 8
2dnl Copyright (C) 1997-2004, 2006-2007, 2009-2010 Free Software Foundation, 2dnl Copyright (C) 1997-2004, 2006-2007, 2009-2013 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
7 7
8dnl From Paul Eggert. 8dnl From Paul Eggert.
9 9
10AC_PREREQ([2.13]) 10AC_PREREQ([2.53])
11 11
12# Define intmax_t to 'long' or 'long long' 12# Define intmax_t to 'long' or 'long long'
13# if it is not already defined in <stdint.h> or <inttypes.h>. 13# if it is not already defined in <stdint.h> or <inttypes.h>.
@@ -38,7 +38,9 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T],
38 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) 38 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
39 AC_REQUIRE([gl_AC_HEADER_STDINT_H]) 39 AC_REQUIRE([gl_AC_HEADER_STDINT_H])
40 AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t], 40 AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t],
41 [AC_TRY_COMPILE([ 41 [AC_COMPILE_IFELSE(
42 [AC_LANG_PROGRAM(
43 [[
42#include <stddef.h> 44#include <stddef.h>
43#include <stdlib.h> 45#include <stdlib.h>
44#if HAVE_STDINT_H_WITH_UINTMAX 46#if HAVE_STDINT_H_WITH_UINTMAX
@@ -47,7 +49,10 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T],
47#if HAVE_INTTYPES_H_WITH_UINTMAX 49#if HAVE_INTTYPES_H_WITH_UINTMAX
48#include <inttypes.h> 50#include <inttypes.h>
49#endif 51#endif
50], [intmax_t x = -1; return !x;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) 52 ]],
53 [[intmax_t x = -1; return !x;]])],
54 [gt_cv_c_intmax_t=yes],
55 [gt_cv_c_intmax_t=no])])
51 if test $gt_cv_c_intmax_t = yes; then 56 if test $gt_cv_c_intmax_t = yes; then
52 AC_DEFINE([HAVE_INTMAX_T], [1], 57 AC_DEFINE([HAVE_INTMAX_T], [1],
53 [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) 58 [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
diff --git a/gl/m4/inttypes-pri.m4 b/gl/m4/inttypes-pri.m4
index 718a4f4..e5a1e05 100644
--- a/gl/m4/inttypes-pri.m4
+++ b/gl/m4/inttypes-pri.m4
@@ -1,12 +1,12 @@
1# inttypes-pri.m4 serial 6 (gettext-0.18) 1# inttypes-pri.m4 serial 7 (gettext-0.18.2)
2dnl Copyright (C) 1997-2002, 2006, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2002, 2006, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7dnl From Bruno Haible. 7dnl From Bruno Haible.
8 8
9AC_PREREQ([2.52]) 9AC_PREREQ([2.53])
10 10
11# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI* 11# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
12# macros to non-string values. This is the case on AIX 4.3.3. 12# macros to non-string values. This is the case on AIX 4.3.3.
@@ -18,11 +18,17 @@ AC_DEFUN([gt_INTTYPES_PRI],
18 AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], 18 AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
19 [gt_cv_inttypes_pri_broken], 19 [gt_cv_inttypes_pri_broken],
20 [ 20 [
21 AC_TRY_COMPILE([#include <inttypes.h> 21 AC_COMPILE_IFELSE(
22 [AC_LANG_PROGRAM(
23 [[
24#include <inttypes.h>
22#ifdef PRId32 25#ifdef PRId32
23char *p = PRId32; 26char *p = PRId32;
24#endif 27#endif
25], [], [gt_cv_inttypes_pri_broken=no], [gt_cv_inttypes_pri_broken=yes]) 28 ]],
29 [[]])],
30 [gt_cv_inttypes_pri_broken=no],
31 [gt_cv_inttypes_pri_broken=yes])
26 ]) 32 ])
27 fi 33 fi
28 if test "$gt_cv_inttypes_pri_broken" = yes; then 34 if test "$gt_cv_inttypes_pri_broken" = yes; then
diff --git a/gl/m4/inttypes_h.m4 b/gl/m4/inttypes_h.m4
index 782d77e..5f05ac5 100644
--- a/gl/m4/inttypes_h.m4
+++ b/gl/m4/inttypes_h.m4
@@ -1,5 +1,5 @@
1# inttypes_h.m4 serial 9 1# inttypes_h.m4 serial 10
2dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2004, 2006, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -12,12 +12,15 @@ dnl From Paul Eggert.
12AC_DEFUN([gl_AC_HEADER_INTTYPES_H], 12AC_DEFUN([gl_AC_HEADER_INTTYPES_H],
13[ 13[
14 AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h], 14 AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h],
15 [AC_TRY_COMPILE( 15 [AC_COMPILE_IFELSE(
16 [#include <sys/types.h> 16 [AC_LANG_PROGRAM(
17#include <inttypes.h>], 17 [[
18 [uintmax_t i = (uintmax_t) -1; return !i;], 18#include <sys/types.h>
19 [gl_cv_header_inttypes_h=yes], 19#include <inttypes.h>
20 [gl_cv_header_inttypes_h=no])]) 20 ]],
21 [[uintmax_t i = (uintmax_t) -1; return !i;]])],
22 [gl_cv_header_inttypes_h=yes],
23 [gl_cv_header_inttypes_h=no])])
21 if test $gl_cv_header_inttypes_h = yes; then 24 if test $gl_cv_header_inttypes_h = yes; then
22 AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], [1], 25 AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], [1],
23 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, 26 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
diff --git a/gl/m4/langinfo_h.m4 b/gl/m4/langinfo_h.m4
index 11a5698..73bef8b 100644
--- a/gl/m4/langinfo_h.m4
+++ b/gl/m4/langinfo_h.m4
@@ -1,5 +1,5 @@
1# langinfo_h.m4 serial 6 1# langinfo_h.m4 serial 7
2dnl Copyright (C) 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -16,12 +16,14 @@ AC_DEFUN([gl_LANGINFO_H],
16 16
17 dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS. 17 dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS.
18 HAVE_LANGINFO_CODESET=0 18 HAVE_LANGINFO_CODESET=0
19 HAVE_LANGINFO_T_FMT_AMPM=0
19 HAVE_LANGINFO_ERA=0 20 HAVE_LANGINFO_ERA=0
21 HAVE_LANGINFO_YESEXPR=0
20 AC_CHECK_HEADERS_ONCE([langinfo.h]) 22 AC_CHECK_HEADERS_ONCE([langinfo.h])
21 if test $ac_cv_header_langinfo_h = yes; then 23 if test $ac_cv_header_langinfo_h = yes; then
22 HAVE_LANGINFO_H=1 24 HAVE_LANGINFO_H=1
23 dnl Determine what <langinfo.h> defines. CODESET and ERA etc. are missing 25 dnl Determine what <langinfo.h> defines. CODESET and ERA etc. are missing
24 dnl on OpenBSD 3.8. 26 dnl on OpenBSD 3.8. T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3.
25 AC_CACHE_CHECK([whether langinfo.h defines CODESET], 27 AC_CACHE_CHECK([whether langinfo.h defines CODESET],
26 [gl_cv_header_langinfo_codeset], 28 [gl_cv_header_langinfo_codeset],
27 [AC_COMPILE_IFELSE( 29 [AC_COMPILE_IFELSE(
@@ -34,6 +36,18 @@ int a = CODESET;
34 if test $gl_cv_header_langinfo_codeset = yes; then 36 if test $gl_cv_header_langinfo_codeset = yes; then
35 HAVE_LANGINFO_CODESET=1 37 HAVE_LANGINFO_CODESET=1
36 fi 38 fi
39 AC_CACHE_CHECK([whether langinfo.h defines T_FMT_AMPM],
40 [gl_cv_header_langinfo_t_fmt_ampm],
41 [AC_COMPILE_IFELSE(
42 [AC_LANG_PROGRAM([[#include <langinfo.h>
43int a = T_FMT_AMPM;
44]])],
45 [gl_cv_header_langinfo_t_fmt_ampm=yes],
46 [gl_cv_header_langinfo_t_fmt_ampm=no])
47 ])
48 if test $gl_cv_header_langinfo_t_fmt_ampm = yes; then
49 HAVE_LANGINFO_T_FMT_AMPM=1
50 fi
37 AC_CACHE_CHECK([whether langinfo.h defines ERA], 51 AC_CACHE_CHECK([whether langinfo.h defines ERA],
38 [gl_cv_header_langinfo_era], 52 [gl_cv_header_langinfo_era],
39 [AC_COMPILE_IFELSE( 53 [AC_COMPILE_IFELSE(
@@ -46,12 +60,26 @@ int a = ERA;
46 if test $gl_cv_header_langinfo_era = yes; then 60 if test $gl_cv_header_langinfo_era = yes; then
47 HAVE_LANGINFO_ERA=1 61 HAVE_LANGINFO_ERA=1
48 fi 62 fi
63 AC_CACHE_CHECK([whether langinfo.h defines YESEXPR],
64 [gl_cv_header_langinfo_yesexpr],
65 [AC_COMPILE_IFELSE(
66 [AC_LANG_PROGRAM([[#include <langinfo.h>
67int a = YESEXPR;
68]])],
69 [gl_cv_header_langinfo_yesexpr=yes],
70 [gl_cv_header_langinfo_yesexpr=no])
71 ])
72 if test $gl_cv_header_langinfo_yesexpr = yes; then
73 HAVE_LANGINFO_YESEXPR=1
74 fi
49 else 75 else
50 HAVE_LANGINFO_H=0 76 HAVE_LANGINFO_H=0
51 fi 77 fi
52 AC_SUBST([HAVE_LANGINFO_H]) 78 AC_SUBST([HAVE_LANGINFO_H])
53 AC_SUBST([HAVE_LANGINFO_CODESET]) 79 AC_SUBST([HAVE_LANGINFO_CODESET])
80 AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM])
54 AC_SUBST([HAVE_LANGINFO_ERA]) 81 AC_SUBST([HAVE_LANGINFO_ERA])
82 AC_SUBST([HAVE_LANGINFO_YESEXPR])
55 83
56 dnl Check for declarations of anything we want to poison if the 84 dnl Check for declarations of anything we want to poison if the
57 dnl corresponding gnulib module is not in use. 85 dnl corresponding gnulib module is not in use.
diff --git a/gl/m4/largefile.m4 b/gl/m4/largefile.m4
new file mode 100644
index 0000000..1e605e3
--- /dev/null
+++ b/gl/m4/largefile.m4
@@ -0,0 +1,146 @@
1# Enable large files on systems where this is not the default.
2
3# Copyright 1992-1996, 1998-2013 Free Software Foundation, Inc.
4# This file is free software; the Free Software Foundation
5# gives unlimited permission to copy and/or distribute it,
6# with or without modifications, as long as this notice is preserved.
7
8# The following implementation works around a problem in autoconf <= 2.69;
9# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5,
10# or configures them incorrectly in some cases.
11m4_version_prereq([2.70], [] ,[
12
13# _AC_SYS_LARGEFILE_TEST_INCLUDES
14# -------------------------------
15m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
16[@%:@include <sys/types.h>
17 /* Check that off_t can represent 2**63 - 1 correctly.
18 We can't simply define LARGE_OFF_T to be 9223372036854775807,
19 since some C++ compilers masquerading as C compilers
20 incorrectly reject 9223372036854775807. */
21@%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
22 int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
23 && LARGE_OFF_T % 2147483647 == 1)
24 ? 1 : -1]];[]dnl
25])
26
27
28# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
29# CACHE-VAR,
30# DESCRIPTION,
31# PROLOGUE, [FUNCTION-BODY])
32# --------------------------------------------------------
33m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
34[AC_CACHE_CHECK([for $1 value needed for large files], [$3],
35[while :; do
36 m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
37 [AC_LANG_PROGRAM([$5], [$6])],
38 [$3=no; break])
39 m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
40 [AC_LANG_PROGRAM([@%:@define $1 $2
41$5], [$6])],
42 [$3=$2; break])
43 $3=unknown
44 break
45done])
46case $$3 in #(
47 no | unknown) ;;
48 *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);;
49esac
50rm -rf conftest*[]dnl
51])# _AC_SYS_LARGEFILE_MACRO_VALUE
52
53
54# AC_SYS_LARGEFILE
55# ----------------
56# By default, many hosts won't let programs access large files;
57# one must use special compiler options to get large-file access to work.
58# For more details about this brain damage please see:
59# http://www.unix-systems.org/version2/whatsnew/lfs20mar.html
60AC_DEFUN([AC_SYS_LARGEFILE],
61[AC_ARG_ENABLE(largefile,
62 [ --disable-largefile omit support for large files])
63if test "$enable_largefile" != no; then
64
65 AC_CACHE_CHECK([for special C compiler options needed for large files],
66 ac_cv_sys_largefile_CC,
67 [ac_cv_sys_largefile_CC=no
68 if test "$GCC" != yes; then
69 ac_save_CC=$CC
70 while :; do
71 # IRIX 6.2 and later do not support large files by default,
72 # so use the C compiler's -n32 option if that helps.
73 AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
74 AC_COMPILE_IFELSE([], [break])
75 CC="$CC -n32"
76 AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
77 break
78 done
79 CC=$ac_save_CC
80 rm -f conftest.$ac_ext
81 fi])
82 if test "$ac_cv_sys_largefile_CC" != no; then
83 CC=$CC$ac_cv_sys_largefile_CC
84 fi
85
86 _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
87 ac_cv_sys_file_offset_bits,
88 [Number of bits in a file offset, on hosts where this is settable.],
89 [_AC_SYS_LARGEFILE_TEST_INCLUDES])
90 if test $ac_cv_sys_file_offset_bits = unknown; then
91 _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
92 ac_cv_sys_large_files,
93 [Define for large files, on AIX-style hosts.],
94 [_AC_SYS_LARGEFILE_TEST_INCLUDES])
95 fi
96
97 AC_DEFINE([_DARWIN_USE_64_BIT_INODE], [1],
98 [Enable large inode numbers on Mac OS X 10.5.])
99fi
100])# AC_SYS_LARGEFILE
101])# m4_version_prereq 2.70
102
103# Enable large files on systems where this is implemented by Gnulib, not by the
104# system headers.
105# Set the variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE if Gnulib
106# overrides ensure that off_t or 'struct size.st_size' are 64-bit, respectively.
107AC_DEFUN([gl_LARGEFILE],
108[
109 AC_REQUIRE([AC_CANONICAL_HOST])
110 case "$host_os" in
111 mingw*)
112 dnl Native Windows.
113 dnl mingw64 defines off_t to a 64-bit type already, if
114 dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE.
115 AC_CACHE_CHECK([for 64-bit off_t], [gl_cv_type_off_t_64],
116 [AC_COMPILE_IFELSE(
117 [AC_LANG_PROGRAM(
118 [[#include <sys/types.h>
119 int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1];
120 ]],
121 [[]])],
122 [gl_cv_type_off_t_64=yes], [gl_cv_type_off_t_64=no])
123 ])
124 if test $gl_cv_type_off_t_64 = no; then
125 WINDOWS_64_BIT_OFF_T=1
126 else
127 WINDOWS_64_BIT_OFF_T=0
128 fi
129 dnl But all native Windows platforms (including mingw64) have a 32-bit
130 dnl st_size member in 'struct stat'.
131 WINDOWS_64_BIT_ST_SIZE=1
132 ;;
133 *)
134 dnl Nothing to do on gnulib's side.
135 dnl A 64-bit off_t is
136 dnl - already the default on Mac OS X, FreeBSD, NetBSD, OpenBSD, IRIX,
137 dnl OSF/1, Cygwin,
138 dnl - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on
139 dnl glibc, HP-UX, Solaris,
140 dnl - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX,
141 dnl - impossible to achieve on Minix 3.1.8.
142 WINDOWS_64_BIT_OFF_T=0
143 WINDOWS_64_BIT_ST_SIZE=0
144 ;;
145 esac
146])
diff --git a/gl/m4/lcmessage.m4 b/gl/m4/lcmessage.m4
index 1a70543..d62a175 100644
--- a/gl/m4/lcmessage.m4
+++ b/gl/m4/lcmessage.m4
@@ -1,5 +1,5 @@
1# lcmessage.m4 serial 6 (gettext-0.18) 1# lcmessage.m4 serial 7 (gettext-0.18.2)
2dnl Copyright (C) 1995-2002, 2004-2005, 2008-2010 Free Software Foundation, 2dnl Copyright (C) 1995-2002, 2004-2005, 2008-2013 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -22,8 +22,12 @@ dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
22AC_DEFUN([gt_LC_MESSAGES], 22AC_DEFUN([gt_LC_MESSAGES],
23[ 23[
24 AC_CACHE_CHECK([for LC_MESSAGES], [gt_cv_val_LC_MESSAGES], 24 AC_CACHE_CHECK([for LC_MESSAGES], [gt_cv_val_LC_MESSAGES],
25 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], 25 [AC_LINK_IFELSE(
26 [gt_cv_val_LC_MESSAGES=yes], [gt_cv_val_LC_MESSAGES=no])]) 26 [AC_LANG_PROGRAM(
27 [[#include <locale.h>]],
28 [[return LC_MESSAGES]])],
29 [gt_cv_val_LC_MESSAGES=yes],
30 [gt_cv_val_LC_MESSAGES=no])])
27 if test $gt_cv_val_LC_MESSAGES = yes; then 31 if test $gt_cv_val_LC_MESSAGES = yes; then
28 AC_DEFINE([HAVE_LC_MESSAGES], [1], 32 AC_DEFINE([HAVE_LC_MESSAGES], [1],
29 [Define if your <locale.h> file defines LC_MESSAGES.]) 33 [Define if your <locale.h> file defines LC_MESSAGES.])
diff --git a/gl/m4/lib-ld.m4 b/gl/m4/lib-ld.m4
index ebb3052..c145e47 100644
--- a/gl/m4/lib-ld.m4
+++ b/gl/m4/lib-ld.m4
@@ -1,50 +1,56 @@
1# lib-ld.m4 serial 4 (gettext-0.18) 1# lib-ld.m4 serial 6
2dnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 1996-2003, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7dnl Subroutines of libtool.m4, 7dnl Subroutines of libtool.m4,
8dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision 8dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
9dnl with libtool.m4. 9dnl collision with libtool.m4.
10 10
11dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. 11dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
12AC_DEFUN([AC_LIB_PROG_LD_GNU], 12AC_DEFUN([AC_LIB_PROG_LD_GNU],
13[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], 13[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
14[# I'd rather use --version here, but apparently some GNU ld's only accept -v. 14[# I'd rather use --version here, but apparently some GNU lds only accept -v.
15case `$LD -v 2>&1 </dev/null` in 15case `$LD -v 2>&1 </dev/null` in
16*GNU* | *'with BFD'*) 16*GNU* | *'with BFD'*)
17 acl_cv_prog_gnu_ld=yes ;; 17 acl_cv_prog_gnu_ld=yes
18 ;;
18*) 19*)
19 acl_cv_prog_gnu_ld=no ;; 20 acl_cv_prog_gnu_ld=no
21 ;;
20esac]) 22esac])
21with_gnu_ld=$acl_cv_prog_gnu_ld 23with_gnu_ld=$acl_cv_prog_gnu_ld
22]) 24])
23 25
24dnl From libtool-1.4. Sets the variable LD. 26dnl From libtool-2.4. Sets the variable LD.
25AC_DEFUN([AC_LIB_PROG_LD], 27AC_DEFUN([AC_LIB_PROG_LD],
26[AC_ARG_WITH([gnu-ld], 28[AC_REQUIRE([AC_PROG_CC])dnl
27[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
28test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
29AC_REQUIRE([AC_PROG_CC])dnl
30AC_REQUIRE([AC_CANONICAL_HOST])dnl 29AC_REQUIRE([AC_CANONICAL_HOST])dnl
30
31AC_ARG_WITH([gnu-ld],
32 [AS_HELP_STRING([--with-gnu-ld],
33 [assume the C compiler uses GNU ld [default=no]])],
34 [test "$withval" = no || with_gnu_ld=yes],
35 [with_gnu_ld=no])dnl
36
31# Prepare PATH_SEPARATOR. 37# Prepare PATH_SEPARATOR.
32# The user is always right. 38# The user is always right.
33if test "${PATH_SEPARATOR+set}" != set; then 39if test "${PATH_SEPARATOR+set}" != set; then
34 echo "#! /bin/sh" >conf$$.sh 40 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
35 echo "exit 0" >>conf$$.sh 41 # contains only /bin. Note that ksh looks also at the FPATH variable,
36 chmod +x conf$$.sh 42 # so we have to set that as well for the test.
37 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then 43 PATH_SEPARATOR=:
38 PATH_SEPARATOR=';' 44 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
39 else 45 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
40 PATH_SEPARATOR=: 46 || PATH_SEPARATOR=';'
41 fi 47 }
42 rm -f conf$$.sh
43fi 48fi
49
44ac_prog=ld 50ac_prog=ld
45if test "$GCC" = yes; then 51if test "$GCC" = yes; then
46 # Check if gcc -print-prog-name=ld gives a path. 52 # Check if gcc -print-prog-name=ld gives a path.
47 AC_MSG_CHECKING([for ld used by GCC]) 53 AC_MSG_CHECKING([for ld used by $CC])
48 case $host in 54 case $host in
49 *-*-mingw*) 55 *-*-mingw*)
50 # gcc leaves a trailing carriage return which upsets mingw 56 # gcc leaves a trailing carriage return which upsets mingw
@@ -54,11 +60,11 @@ if test "$GCC" = yes; then
54 esac 60 esac
55 case $ac_prog in 61 case $ac_prog in
56 # Accept absolute paths. 62 # Accept absolute paths.
57 [[\\/]* | [A-Za-z]:[\\/]*)] 63 [[\\/]]* | ?:[[\\/]]*)
58 [re_direlt='/[^/][^/]*/\.\./'] 64 re_direlt='/[[^/]][[^/]]*/\.\./'
59 # Canonicalize the path of ld 65 # Canonicalize the pathname of ld
60 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` 66 ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
61 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do 67 while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
62 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` 68 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
63 done 69 done
64 test -z "$LD" && LD="$ac_prog" 70 test -z "$LD" && LD="$ac_prog"
@@ -79,23 +85,26 @@ else
79fi 85fi
80AC_CACHE_VAL([acl_cv_path_LD], 86AC_CACHE_VAL([acl_cv_path_LD],
81[if test -z "$LD"; then 87[if test -z "$LD"; then
82 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" 88 acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
83 for ac_dir in $PATH; do 89 for ac_dir in $PATH; do
90 IFS="$acl_save_ifs"
84 test -z "$ac_dir" && ac_dir=. 91 test -z "$ac_dir" && ac_dir=.
85 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then 92 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
86 acl_cv_path_LD="$ac_dir/$ac_prog" 93 acl_cv_path_LD="$ac_dir/$ac_prog"
87 # Check to see if the program is GNU ld. I'd rather use --version, 94 # Check to see if the program is GNU ld. I'd rather use --version,
88 # but apparently some GNU ld's only accept -v. 95 # but apparently some variants of GNU ld only accept -v.
89 # Break only if it was the GNU/non-GNU ld that we prefer. 96 # Break only if it was the GNU/non-GNU ld that we prefer.
90 case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in 97 case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
91 *GNU* | *'with BFD'*) 98 *GNU* | *'with BFD'*)
92 test "$with_gnu_ld" != no && break ;; 99 test "$with_gnu_ld" != no && break
100 ;;
93 *) 101 *)
94 test "$with_gnu_ld" != yes && break ;; 102 test "$with_gnu_ld" != yes && break
103 ;;
95 esac 104 esac
96 fi 105 fi
97 done 106 done
98 IFS="$ac_save_ifs" 107 IFS="$acl_save_ifs"
99else 108else
100 acl_cv_path_LD="$LD" # Let the user override the test with a path. 109 acl_cv_path_LD="$LD" # Let the user override the test with a path.
101fi]) 110fi])
diff --git a/gl/m4/lib-link.m4 b/gl/m4/lib-link.m4
index 59b367d..073f040 100644
--- a/gl/m4/lib-link.m4
+++ b/gl/m4/lib-link.m4
@@ -1,5 +1,5 @@
1# lib-link.m4 serial 23 (gettext-0.18.2) 1# lib-link.m4 serial 26 (gettext-0.18.2)
2dnl Copyright (C) 2001-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -85,7 +85,8 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
85 *" -l"*) LIBS="$LIBS $LIB[]NAME" ;; 85 *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
86 *) LIBS="$LIB[]NAME $LIBS" ;; 86 *) LIBS="$LIB[]NAME $LIBS" ;;
87 esac 87 esac
88 AC_TRY_LINK([$3], [$4], 88 AC_LINK_IFELSE(
89 [AC_LANG_PROGRAM([[$3]], [[$4]])],
89 [ac_cv_lib[]Name=yes], 90 [ac_cv_lib[]Name=yes],
90 [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])']) 91 [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
91 LIBS="$ac_save_LIBS" 92 LIBS="$ac_save_LIBS"
@@ -115,6 +116,8 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
115dnl Determine the platform dependent parameters needed to use rpath: 116dnl Determine the platform dependent parameters needed to use rpath:
116dnl acl_libext, 117dnl acl_libext,
117dnl acl_shlibext, 118dnl acl_shlibext,
119dnl acl_libname_spec,
120dnl acl_library_names_spec,
118dnl acl_hardcode_libdir_flag_spec, 121dnl acl_hardcode_libdir_flag_spec,
119dnl acl_hardcode_libdir_separator, 122dnl acl_hardcode_libdir_separator,
120dnl acl_hardcode_direct, 123dnl acl_hardcode_direct,
@@ -165,7 +168,7 @@ AC_DEFUN([AC_LIB_FROMPACKAGE],
165 pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], 168 pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
166 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) 169 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
167 define([acl_libsinpackage_]PACKUP, 170 define([acl_libsinpackage_]PACKUP,
168 m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1]) 171 m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
169 popdef([PACKUP]) 172 popdef([PACKUP])
170 popdef([PACK]) 173 popdef([PACK])
171]) 174])
diff --git a/gl/m4/lib-prefix.m4 b/gl/m4/lib-prefix.m4
index 1601cea..60908e8 100644
--- a/gl/m4/lib-prefix.m4
+++ b/gl/m4/lib-prefix.m4
@@ -1,5 +1,5 @@
1# lib-prefix.m4 serial 7 (gettext-0.18) 1# lib-prefix.m4 serial 7 (gettext-0.18)
2dnl Copyright (C) 2001-2005, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2005, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
diff --git a/gl/m4/localcharset.m4 b/gl/m4/localcharset.m4
index ee2e801..2e93e58 100644
--- a/gl/m4/localcharset.m4
+++ b/gl/m4/localcharset.m4
@@ -1,5 +1,5 @@
1# localcharset.m4 serial 7 1# localcharset.m4 serial 7
2dnl Copyright (C) 2002, 2004, 2006, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2004, 2006, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
diff --git a/gl/m4/locale-fr.m4 b/gl/m4/locale-fr.m4
index 001f539..ef199e3 100644
--- a/gl/m4/locale-fr.m4
+++ b/gl/m4/locale-fr.m4
@@ -1,5 +1,5 @@
1# locale-fr.m4 serial 11 1# locale-fr.m4 serial 17
2dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2005-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -25,17 +25,30 @@ struct tm t;
25char buf[16]; 25char buf[16];
26int main () { 26int main () {
27 /* Check whether the given locale name is recognized by the system. */ 27 /* Check whether the given locale name is recognized by the system. */
28#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
29 /* On native Windows, setlocale(category, "") looks at the system settings,
30 not at the environment variables. Also, when an encoding suffix such
31 as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE
32 category of the locale to "C". */
33 if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
34 || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
35 return 1;
36#else
28 if (setlocale (LC_ALL, "") == NULL) return 1; 37 if (setlocale (LC_ALL, "") == NULL) return 1;
38#endif
29 /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". 39 /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
30 On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) 40 On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
31 is empty, and the behaviour of Tcl 8.4 in this locale is not useful. 41 is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
32 On OpenBSD 4.0, when an unsupported locale is specified, setlocale() 42 On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
33 succeeds but then nl_langinfo(CODESET) is "646". In this situation, 43 succeeds but then nl_langinfo(CODESET) is "646". In this situation,
34 some unit tests fail. */ 44 some unit tests fail.
45 On MirBSD 10, when an unsupported locale is specified, setlocale()
46 succeeds but then nl_langinfo(CODESET) is "UTF-8". */
35#if HAVE_LANGINFO_CODESET 47#if HAVE_LANGINFO_CODESET
36 { 48 {
37 const char *cs = nl_langinfo (CODESET); 49 const char *cs = nl_langinfo (CODESET);
38 if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) 50 if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0
51 || strcmp (cs, "UTF-8") == 0)
39 return 1; 52 return 1;
40 } 53 }
41#endif 54#endif
@@ -50,46 +63,67 @@ int main () {
50 one byte long. This excludes the UTF-8 encoding. */ 63 one byte long. This excludes the UTF-8 encoding. */
51 t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; 64 t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
52 if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; 65 if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1;
66#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */
53 /* Check whether the decimal separator is a comma. 67 /* Check whether the decimal separator is a comma.
54 On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point 68 On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point
55 are nl_langinfo(RADIXCHAR) are both ".". */ 69 are nl_langinfo(RADIXCHAR) are both ".". */
56 if (localeconv () ->decimal_point[0] != ',') return 1; 70 if (localeconv () ->decimal_point[0] != ',') return 1;
71#endif
57 return 0; 72 return 0;
58} 73}
59changequote([,])dnl 74changequote([,])dnl
60 ])]) 75 ])])
61 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then 76 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
62 # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because 77 case "$host_os" in
63 # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the 78 # Handle native Windows specially, because there setlocale() interprets
64 # configure script would override the LC_ALL setting. Likewise for 79 # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
65 # LC_CTYPE, which is also set at the beginning of the configure script. 80 # "fr" or "fra" as "French" or "French_France.1252",
66 # Test for the usual locale name. 81 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
67 if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 82 # "ja" as "Japanese" or "Japanese_Japan.932",
68 gt_cv_locale_fr=fr_FR 83 # and similar.
69 else 84 mingw*)
70 # Test for the locale name with explicit encoding suffix. 85 # Test for the native Windows locale name.
71 if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 86 if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
72 gt_cv_locale_fr=fr_FR.ISO-8859-1 87 gt_cv_locale_fr=French_France.1252
73 else
74 # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name.
75 if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
76 gt_cv_locale_fr=fr_FR.ISO8859-1
77 else 88 else
78 # Test for the HP-UX locale name. 89 # None found.
79 if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 90 gt_cv_locale_fr=none
80 gt_cv_locale_fr=fr_FR.iso88591 91 fi
92 ;;
93 *)
94 # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
95 # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the
96 # configure script would override the LC_ALL setting. Likewise for
97 # LC_CTYPE, which is also set at the beginning of the configure script.
98 # Test for the usual locale name.
99 if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
100 gt_cv_locale_fr=fr_FR
101 else
102 # Test for the locale name with explicit encoding suffix.
103 if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
104 gt_cv_locale_fr=fr_FR.ISO-8859-1
81 else 105 else
82 # Test for the Solaris 7 locale name. 106 # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name.
83 if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 107 if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
84 gt_cv_locale_fr=fr 108 gt_cv_locale_fr=fr_FR.ISO8859-1
85 else 109 else
86 # None found. 110 # Test for the HP-UX locale name.
87 gt_cv_locale_fr=none 111 if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
112 gt_cv_locale_fr=fr_FR.iso88591
113 else
114 # Test for the Solaris 7 locale name.
115 if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
116 gt_cv_locale_fr=fr
117 else
118 # None found.
119 gt_cv_locale_fr=none
120 fi
121 fi
88 fi 122 fi
89 fi 123 fi
90 fi 124 fi
91 fi 125 ;;
92 fi 126 esac
93 fi 127 fi
94 rm -fr conftest* 128 rm -fr conftest*
95 ]) 129 ])
@@ -119,9 +153,19 @@ int main () {
119 variables, and all locales use the UTF-8 encoding. */ 153 variables, and all locales use the UTF-8 encoding. */
120#if !(defined __BEOS__ || defined __HAIKU__) 154#if !(defined __BEOS__ || defined __HAIKU__)
121 /* Check whether the given locale name is recognized by the system. */ 155 /* Check whether the given locale name is recognized by the system. */
156# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
157 /* On native Windows, setlocale(category, "") looks at the system settings,
158 not at the environment variables. Also, when an encoding suffix such
159 as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE
160 category of the locale to "C". */
161 if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
162 || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
163 return 1;
164# else
122 if (setlocale (LC_ALL, "") == NULL) return 1; 165 if (setlocale (LC_ALL, "") == NULL) return 1;
166# endif
123 /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". 167 /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
124 On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) 168 On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
125 is empty, and the behaviour of Tcl 8.4 in this locale is not useful. 169 is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
126 On OpenBSD 4.0, when an unsupported locale is specified, setlocale() 170 On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
127 succeeds but then nl_langinfo(CODESET) is "646". In this situation, 171 succeeds but then nl_langinfo(CODESET) is "646". In this situation,
@@ -147,36 +191,57 @@ int main () {
147 || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') 191 || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v')
148 return 1; 192 return 1;
149#endif 193#endif
194#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */
150 /* Check whether the decimal separator is a comma. 195 /* Check whether the decimal separator is a comma.
151 On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point 196 On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point
152 are nl_langinfo(RADIXCHAR) are both ".". */ 197 are nl_langinfo(RADIXCHAR) are both ".". */
153 if (localeconv () ->decimal_point[0] != ',') return 1; 198 if (localeconv () ->decimal_point[0] != ',') return 1;
199#endif
154 return 0; 200 return 0;
155} 201}
156changequote([,])dnl 202changequote([,])dnl
157 ])]) 203 ])])
158 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then 204 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
159 # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because 205 case "$host_os" in
160 # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the 206 # Handle native Windows specially, because there setlocale() interprets
161 # configure script would override the LC_ALL setting. Likewise for 207 # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
162 # LC_CTYPE, which is also set at the beginning of the configure script. 208 # "fr" or "fra" as "French" or "French_France.1252",
163 # Test for the usual locale name. 209 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
164 if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 210 # "ja" as "Japanese" or "Japanese_Japan.932",
165 gt_cv_locale_fr_utf8=fr_FR 211 # and similar.
166 else 212 mingw*)
167 # Test for the locale name with explicit encoding suffix. 213 # Test for the hypothetical native Windows locale name.
168 if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 214 if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
169 gt_cv_locale_fr_utf8=fr_FR.UTF-8 215 gt_cv_locale_fr_utf8=French_France.65001
170 else
171 # Test for the Solaris 7 locale name.
172 if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
173 gt_cv_locale_fr_utf8=fr.UTF-8
174 else 216 else
175 # None found. 217 # None found.
176 gt_cv_locale_fr_utf8=none 218 gt_cv_locale_fr_utf8=none
177 fi 219 fi
178 fi 220 ;;
179 fi 221 *)
222 # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
223 # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the
224 # configure script would override the LC_ALL setting. Likewise for
225 # LC_CTYPE, which is also set at the beginning of the configure script.
226 # Test for the usual locale name.
227 if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
228 gt_cv_locale_fr_utf8=fr_FR
229 else
230 # Test for the locale name with explicit encoding suffix.
231 if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
232 gt_cv_locale_fr_utf8=fr_FR.UTF-8
233 else
234 # Test for the Solaris 7 locale name.
235 if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
236 gt_cv_locale_fr_utf8=fr.UTF-8
237 else
238 # None found.
239 gt_cv_locale_fr_utf8=none
240 fi
241 fi
242 fi
243 ;;
244 esac
180 fi 245 fi
181 rm -fr conftest* 246 rm -fr conftest*
182 ]) 247 ])
diff --git a/gl/m4/locale-ja.m4 b/gl/m4/locale-ja.m4
index 0eedaf1..132a3e7 100644
--- a/gl/m4/locale-ja.m4
+++ b/gl/m4/locale-ja.m4
@@ -1,5 +1,5 @@
1# locale-ja.m4 serial 7 1# locale-ja.m4 serial 12
2dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2005-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -27,17 +27,30 @@ int main ()
27{ 27{
28 const char *p; 28 const char *p;
29 /* Check whether the given locale name is recognized by the system. */ 29 /* Check whether the given locale name is recognized by the system. */
30#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
31 /* On native Windows, setlocale(category, "") looks at the system settings,
32 not at the environment variables. Also, when an encoding suffix such
33 as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE
34 category of the locale to "C". */
35 if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
36 || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
37 return 1;
38#else
30 if (setlocale (LC_ALL, "") == NULL) return 1; 39 if (setlocale (LC_ALL, "") == NULL) return 1;
40#endif
31 /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". 41 /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
32 On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) 42 On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
33 is empty, and the behaviour of Tcl 8.4 in this locale is not useful. 43 is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
34 On OpenBSD 4.0, when an unsupported locale is specified, setlocale() 44 On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
35 succeeds but then nl_langinfo(CODESET) is "646". In this situation, 45 succeeds but then nl_langinfo(CODESET) is "646". In this situation,
36 some unit tests fail. */ 46 some unit tests fail.
47 On MirBSD 10, when an unsupported locale is specified, setlocale()
48 succeeds but then nl_langinfo(CODESET) is "UTF-8". */
37#if HAVE_LANGINFO_CODESET 49#if HAVE_LANGINFO_CODESET
38 { 50 {
39 const char *cs = nl_langinfo (CODESET); 51 const char *cs = nl_langinfo (CODESET);
40 if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) 52 if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0
53 || strcmp (cs, "UTF-8") == 0)
41 return 1; 54 return 1;
42 } 55 }
43#endif 56#endif
@@ -52,7 +65,7 @@ int main ()
52 if (MB_CUR_MAX == 1) 65 if (MB_CUR_MAX == 1)
53 return 1; 66 return 1;
54 /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. 67 /* Check whether in a month name, no byte in the range 0x80..0x9F occurs.
55 This excludes the UTF-8 encoding. */ 68 This excludes the UTF-8 encoding (except on MirBSD). */
56 t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; 69 t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
57 if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; 70 if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1;
58 for (p = buf; *p != '\0'; p++) 71 for (p = buf; *p != '\0'; p++)
@@ -63,42 +76,58 @@ int main ()
63changequote([,])dnl 76changequote([,])dnl
64 ])]) 77 ])])
65 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then 78 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
66 # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because 79 case "$host_os" in
67 # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the 80 # Handle native Windows specially, because there setlocale() interprets
68 # configure script would override the LC_ALL setting. Likewise for 81 # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
69 # LC_CTYPE, which is also set at the beginning of the configure script. 82 # "fr" or "fra" as "French" or "French_France.1252",
70 # Test for the AIX locale name. 83 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
71 if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 84 # "ja" as "Japanese" or "Japanese_Japan.932",
72 gt_cv_locale_ja=ja_JP 85 # and similar.
73 else 86 mingw*)
74 # Test for the locale name with explicit encoding suffix. 87 # Note that on native Windows, the Japanese locale is
75 if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 88 # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we
76 gt_cv_locale_ja=ja_JP.EUC-JP 89 # cannot use it here.
77 else 90 gt_cv_locale_ja=none
78 # Test for the HP-UX, OSF/1, NetBSD locale name. 91 ;;
79 if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 92 *)
80 gt_cv_locale_ja=ja_JP.eucJP 93 # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
94 # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the
95 # configure script would override the LC_ALL setting. Likewise for
96 # LC_CTYPE, which is also set at the beginning of the configure script.
97 # Test for the AIX locale name.
98 if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
99 gt_cv_locale_ja=ja_JP
81 else 100 else
82 # Test for the IRIX, FreeBSD locale name. 101 # Test for the locale name with explicit encoding suffix.
83 if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 102 if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
84 gt_cv_locale_ja=ja_JP.EUC 103 gt_cv_locale_ja=ja_JP.EUC-JP
85 else 104 else
86 # Test for the Solaris 7 locale name. 105 # Test for the HP-UX, OSF/1, NetBSD locale name.
87 if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 106 if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
88 gt_cv_locale_ja=ja 107 gt_cv_locale_ja=ja_JP.eucJP
89 else 108 else
90 # Special test for NetBSD 1.6. 109 # Test for the IRIX, FreeBSD locale name.
91 if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then 110 if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
92 gt_cv_locale_ja=ja_JP.eucJP 111 gt_cv_locale_ja=ja_JP.EUC
93 else 112 else
94 # None found. 113 # Test for the Solaris 7 locale name.
95 gt_cv_locale_ja=none 114 if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
115 gt_cv_locale_ja=ja
116 else
117 # Special test for NetBSD 1.6.
118 if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then
119 gt_cv_locale_ja=ja_JP.eucJP
120 else
121 # None found.
122 gt_cv_locale_ja=none
123 fi
124 fi
96 fi 125 fi
97 fi 126 fi
98 fi 127 fi
99 fi 128 fi
100 fi 129 ;;
101 fi 130 esac
102 fi 131 fi
103 rm -fr conftest* 132 rm -fr conftest*
104 ]) 133 ])
diff --git a/gl/m4/locale-zh.m4 b/gl/m4/locale-zh.m4
index 777fd14..4eed73f 100644
--- a/gl/m4/locale-zh.m4
+++ b/gl/m4/locale-zh.m4
@@ -1,5 +1,5 @@
1# locale-zh.m4 serial 6 1# locale-zh.m4 serial 12
2dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2005-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -28,17 +28,30 @@ int main ()
28{ 28{
29 const char *p; 29 const char *p;
30 /* Check whether the given locale name is recognized by the system. */ 30 /* Check whether the given locale name is recognized by the system. */
31#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
32 /* On native Windows, setlocale(category, "") looks at the system settings,
33 not at the environment variables. Also, when an encoding suffix such
34 as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE
35 category of the locale to "C". */
36 if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
37 || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
38 return 1;
39#else
31 if (setlocale (LC_ALL, "") == NULL) return 1; 40 if (setlocale (LC_ALL, "") == NULL) return 1;
41#endif
32 /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". 42 /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
33 On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) 43 On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
34 is empty, and the behaviour of Tcl 8.4 in this locale is not useful. 44 is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
35 On OpenBSD 4.0, when an unsupported locale is specified, setlocale() 45 On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
36 succeeds but then nl_langinfo(CODESET) is "646". In this situation, 46 succeeds but then nl_langinfo(CODESET) is "646". In this situation,
37 some unit tests fail. */ 47 some unit tests fail.
48 On MirBSD 10, when an unsupported locale is specified, setlocale()
49 succeeds but then nl_langinfo(CODESET) is "UTF-8". */
38#if HAVE_LANGINFO_CODESET 50#if HAVE_LANGINFO_CODESET
39 { 51 {
40 const char *cs = nl_langinfo (CODESET); 52 const char *cs = nl_langinfo (CODESET);
41 if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) 53 if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0
54 || strcmp (cs, "UTF-8") == 0)
42 return 1; 55 return 1;
43 } 56 }
44#endif 57#endif
@@ -49,7 +62,7 @@ int main ()
49 if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; 62 if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
50#endif 63#endif
51 /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. 64 /* Check whether in a month name, no byte in the range 0x80..0x9F occurs.
52 This excludes the UTF-8 encoding. */ 65 This excludes the UTF-8 encoding (except on MirBSD). */
53 t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; 66 t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
54 if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; 67 if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1;
55 for (p = buf; *p != '\0'; p++) 68 for (p = buf; *p != '\0'; p++)
@@ -64,22 +77,47 @@ int main ()
64changequote([,])dnl 77changequote([,])dnl
65 ])]) 78 ])])
66 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then 79 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
67 # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because 80 case "$host_os" in
68 # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the 81 # Handle native Windows specially, because there setlocale() interprets
69 # configure script would override the LC_ALL setting. Likewise for 82 # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
70 # LC_CTYPE, which is also set at the beginning of the configure script. 83 # "fr" or "fra" as "French" or "French_France.1252",
71 # Test for the locale name without encoding suffix. 84 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
72 if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 85 # "ja" as "Japanese" or "Japanese_Japan.932",
73 gt_cv_locale_zh_CN=zh_CN 86 # and similar.
74 else 87 mingw*)
75 # Test for the locale name with explicit encoding suffix. 88 # Test for the hypothetical native Windows locale name.
76 if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 89 if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
77 gt_cv_locale_zh_CN=zh_CN.GB18030 90 gt_cv_locale_zh_CN=Chinese_China.54936
78 else 91 else
79 # None found. 92 # None found.
93 gt_cv_locale_zh_CN=none
94 fi
95 ;;
96 solaris2.8)
97 # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are
98 # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK.
99 # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core.
80 gt_cv_locale_zh_CN=none 100 gt_cv_locale_zh_CN=none
81 fi 101 ;;
82 fi 102 *)
103 # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
104 # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the
105 # configure script would override the LC_ALL setting. Likewise for
106 # LC_CTYPE, which is also set at the beginning of the configure script.
107 # Test for the locale name without encoding suffix.
108 if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
109 gt_cv_locale_zh_CN=zh_CN
110 else
111 # Test for the locale name with explicit encoding suffix.
112 if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
113 gt_cv_locale_zh_CN=zh_CN.GB18030
114 else
115 # None found.
116 gt_cv_locale_zh_CN=none
117 fi
118 fi
119 ;;
120 esac
83 else 121 else
84 # If there was a link error, due to mblen(), the system is so old that 122 # If there was a link error, due to mblen(), the system is so old that
85 # it certainly doesn't have a chinese locale. 123 # it certainly doesn't have a chinese locale.
diff --git a/gl/m4/locale_h.m4 b/gl/m4/locale_h.m4
index 18a119b..8bd12e8 100644
--- a/gl/m4/locale_h.m4
+++ b/gl/m4/locale_h.m4
@@ -1,5 +1,5 @@
1# locale_h.m4 serial 10 1# locale_h.m4 serial 19
2dnl Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -10,16 +10,30 @@ AC_DEFUN([gl_LOCALE_H],
10 dnl once only, before all statements that occur in other macros. 10 dnl once only, before all statements that occur in other macros.
11 AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) 11 AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
12 12
13 dnl Persuade glibc <locale.h> to define locale_t. 13 dnl Persuade glibc <locale.h> to define locale_t and the int_p_*, int_n_*
14 dnl members of 'struct lconv'.
14 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 15 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
15 16
16 dnl If <stddef.h> is replaced, then <locale.h> must also be replaced. 17 dnl If <stddef.h> is replaced, then <locale.h> must also be replaced.
17 AC_REQUIRE([gl_STDDEF_H]) 18 AC_REQUIRE([gl_STDDEF_H])
18 19
20 dnl Solaris 11 2011-11 defines the int_p_*, int_n_* members of 'struct lconv'
21 dnl only if _LCONV_C99 is defined.
22 AC_REQUIRE([AC_CANONICAL_HOST])
23 case "$host_os" in
24 solaris*)
25 AC_DEFINE([_LCONV_C99], [1], [Define to 1 on Solaris.])
26 ;;
27 esac
28
19 AC_CACHE_CHECK([whether locale.h conforms to POSIX:2001], 29 AC_CACHE_CHECK([whether locale.h conforms to POSIX:2001],
20 [gl_cv_header_locale_h_posix2001], 30 [gl_cv_header_locale_h_posix2001],
21 [AC_TRY_COMPILE([#include <locale.h> 31 [AC_COMPILE_IFELSE(
22int x = LC_MESSAGES;], [], 32 [AC_LANG_PROGRAM(
33 [[#include <locale.h>
34 int x = LC_MESSAGES;
35 int y = sizeof (((struct lconv *) 0)->decimal_point);]],
36 [[]])],
23 [gl_cv_header_locale_h_posix2001=yes], 37 [gl_cv_header_locale_h_posix2001=yes],
24 [gl_cv_header_locale_h_posix2001=no])]) 38 [gl_cv_header_locale_h_posix2001=no])])
25 39
@@ -28,12 +42,15 @@ int x = LC_MESSAGES;], [],
28 if test $ac_cv_header_xlocale_h = yes; then 42 if test $ac_cv_header_xlocale_h = yes; then
29 HAVE_XLOCALE_H=1 43 HAVE_XLOCALE_H=1
30 dnl Check whether use of locale_t requires inclusion of <xlocale.h>, 44 dnl Check whether use of locale_t requires inclusion of <xlocale.h>,
31 dnl e.g. on MacOS X 10.5. If <locale.h> does not define locale_t by 45 dnl e.g. on Mac OS X 10.5. If <locale.h> does not define locale_t by
32 dnl itself, we assume that <xlocale.h> will do so. 46 dnl itself, we assume that <xlocale.h> will do so.
33 AC_CACHE_CHECK([whether locale.h defines locale_t], 47 AC_CACHE_CHECK([whether locale.h defines locale_t],
34 [gl_cv_header_locale_has_locale_t], 48 [gl_cv_header_locale_has_locale_t],
35 [AC_TRY_COMPILE([#include <locale.h> 49 [AC_COMPILE_IFELSE(
36locale_t x;], [], 50 [AC_LANG_PROGRAM(
51 [[#include <locale.h>
52 locale_t x;]],
53 [[]])],
37 [gl_cv_header_locale_has_locale_t=yes], 54 [gl_cv_header_locale_has_locale_t=yes],
38 [gl_cv_header_locale_has_locale_t=no]) 55 [gl_cv_header_locale_has_locale_t=no])
39 ]) 56 ])
@@ -48,15 +65,29 @@ locale_t x;], [],
48 fi 65 fi
49 AC_SUBST([HAVE_XLOCALE_H]) 66 AC_SUBST([HAVE_XLOCALE_H])
50 67
51 dnl <locale.h> is always overridden, because of GNULIB_POSIXCHECK. 68 dnl Check whether 'struct lconv' is complete.
52 gl_CHECK_NEXT_HEADERS([locale.h]) 69 dnl Bionic libc's 'struct lconv' is just a dummy.
53 70 dnl On OpenBSD 4.9, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin 1.5.x,
54 if test -n "$STDDEF_H" \ 71 dnl mingw, MSVC 9, it lacks the int_p_* and int_n_* members.
55 || test $gl_cv_header_locale_h_posix2001 = no \ 72 AC_CACHE_CHECK([whether struct lconv is properly defined],
56 || test $gl_cv_header_locale_h_needs_xlocale_h = yes; then 73 [gl_cv_sys_struct_lconv_ok],
57 gl_REPLACE_LOCALE_H 74 [AC_COMPILE_IFELSE(
75 [AC_LANG_PROGRAM(
76 [[#include <locale.h>
77 struct lconv l;
78 int x = sizeof (l.decimal_point);
79 int y = sizeof (l.int_p_cs_precedes);]],
80 [[]])],
81 [gl_cv_sys_struct_lconv_ok=yes],
82 [gl_cv_sys_struct_lconv_ok=no])
83 ])
84 if test $gl_cv_sys_struct_lconv_ok = no; then
85 REPLACE_STRUCT_LCONV=1
58 fi 86 fi
59 87
88 dnl <locale.h> is always overridden, because of GNULIB_POSIXCHECK.
89 gl_NEXT_HEADERS([locale.h])
90
60 dnl Check for declarations of anything we want to poison if the 91 dnl Check for declarations of anything we want to poison if the
61 dnl corresponding gnulib module is not in use. 92 dnl corresponding gnulib module is not in use.
62 gl_WARN_ON_USE_PREPARE([[#include <locale.h> 93 gl_WARN_ON_USE_PREPARE([[#include <locale.h>
@@ -64,14 +95,8 @@ locale_t x;], [],
64#if HAVE_XLOCALE_H 95#if HAVE_XLOCALE_H
65# include <xlocale.h> 96# include <xlocale.h>
66#endif 97#endif
67 ]], [duplocale]) 98 ]],
68]) 99 [setlocale duplocale])
69
70dnl Unconditionally enables the replacement of <locale.h>.
71AC_DEFUN([gl_REPLACE_LOCALE_H],
72[
73 dnl This is a no-op, because <locale.h> is always overridden.
74 :
75]) 100])
76 101
77AC_DEFUN([gl_LOCALE_MODULE_INDICATOR], 102AC_DEFUN([gl_LOCALE_MODULE_INDICATOR],
@@ -85,8 +110,13 @@ AC_DEFUN([gl_LOCALE_MODULE_INDICATOR],
85 110
86AC_DEFUN([gl_LOCALE_H_DEFAULTS], 111AC_DEFUN([gl_LOCALE_H_DEFAULTS],
87[ 112[
113 GNULIB_LOCALECONV=0; AC_SUBST([GNULIB_LOCALECONV])
114 GNULIB_SETLOCALE=0; AC_SUBST([GNULIB_SETLOCALE])
88 GNULIB_DUPLOCALE=0; AC_SUBST([GNULIB_DUPLOCALE]) 115 GNULIB_DUPLOCALE=0; AC_SUBST([GNULIB_DUPLOCALE])
89 dnl Assume proper GNU behavior unless another module says otherwise. 116 dnl Assume proper GNU behavior unless another module says otherwise.
90 HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) 117 HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE])
91 REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE]) 118 REPLACE_LOCALECONV=0; AC_SUBST([REPLACE_LOCALECONV])
119 REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE])
120 REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE])
121 REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV])
92]) 122])
diff --git a/gl/m4/localeconv.m4 b/gl/m4/localeconv.m4
new file mode 100644
index 0000000..b8bb596
--- /dev/null
+++ b/gl/m4/localeconv.m4
@@ -0,0 +1,22 @@
1# localeconv.m4 serial 1
2dnl Copyright (C) 2012-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_LOCALECONV],
8[
9 AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
10 AC_REQUIRE([gl_LOCALE_H])
11
12 if test $REPLACE_STRUCT_LCONV = 1; then
13 REPLACE_LOCALECONV=1
14 fi
15])
16
17# Prerequisites of lib/localeconv.c.
18AC_DEFUN([gl_PREREQ_LOCALECONV],
19[
20 AC_CHECK_MEMBERS([struct lconv.decimal_point], [], [],
21 [[#include <locale.h>]])
22])
diff --git a/gl/m4/lock.m4 b/gl/m4/lock.m4
index 9da8465..aae1701 100644
--- a/gl/m4/lock.m4
+++ b/gl/m4/lock.m4
@@ -1,5 +1,5 @@
1# lock.m4 serial 10 (gettext-0.18) 1# lock.m4 serial 13 (gettext-0.18.2)
2dnl Copyright (C) 2005-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2005-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -10,7 +10,7 @@ AC_DEFUN([gl_LOCK],
10[ 10[
11 AC_REQUIRE([gl_THREADLIB]) 11 AC_REQUIRE([gl_THREADLIB])
12 if test "$gl_threads_api" = posix; then 12 if test "$gl_threads_api" = posix; then
13 # OSF/1 4.0 and MacOS X 10.1 lack the pthread_rwlock_t type and the 13 # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the
14 # pthread_rwlock_* functions. 14 # pthread_rwlock_* functions.
15 AC_CHECK_TYPE([pthread_rwlock_t], 15 AC_CHECK_TYPE([pthread_rwlock_t],
16 [AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1], 16 [AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1],
@@ -18,20 +18,25 @@ AC_DEFUN([gl_LOCK],
18 [], 18 [],
19 [#include <pthread.h>]) 19 [#include <pthread.h>])
20 # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. 20 # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro.
21 AC_TRY_COMPILE([#include <pthread.h>], 21 AC_COMPILE_IFELSE([
22 [#if __FreeBSD__ == 4 22 AC_LANG_PROGRAM(
23 [[#include <pthread.h>]],
24 [[
25#if __FreeBSD__ == 4
23error "No, in FreeBSD 4.0 recursive mutexes actually don't work." 26error "No, in FreeBSD 4.0 recursive mutexes actually don't work."
27#elif (defined __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ \
28 && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070)
29error "No, in Mac OS X < 10.7 recursive mutexes actually don't work."
24#else 30#else
25int x = (int)PTHREAD_MUTEX_RECURSIVE; 31int x = (int)PTHREAD_MUTEX_RECURSIVE;
26return !x; 32return !x;
27#endif], 33#endif
34 ]])],
28 [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1], 35 [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1],
29 [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])]) 36 [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])])
30 fi 37 fi
31 gl_PREREQ_LOCK 38 gl_PREREQ_LOCK
32]) 39])
33 40
34# Prerequisites of lib/lock.c. 41# Prerequisites of lib/glthread/lock.c.
35AC_DEFUN([gl_PREREQ_LOCK], [ 42AC_DEFUN([gl_PREREQ_LOCK], [:])
36 AC_REQUIRE([AC_C_INLINE])
37])
diff --git a/gl/m4/longlong.m4 b/gl/m4/longlong.m4
index cca3c1a..3af6ab5 100644
--- a/gl/m4/longlong.m4
+++ b/gl/m4/longlong.m4
@@ -1,5 +1,5 @@
1# longlong.m4 serial 14 1# longlong.m4 serial 17
2dnl Copyright (C) 1999-2007, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 1999-2007, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -7,8 +7,8 @@ dnl with or without modifications, as long as this notice is preserved.
7dnl From Paul Eggert. 7dnl From Paul Eggert.
8 8
9# Define HAVE_LONG_LONG_INT if 'long long int' works. 9# Define HAVE_LONG_LONG_INT if 'long long int' works.
10# This fixes a bug in Autoconf 2.61, but can be removed once we 10# This fixes a bug in Autoconf 2.61, and can be faster
11# assume 2.62 everywhere. 11# than what's in Autoconf 2.62 through 2.68.
12 12
13# Note: If the type 'long long int' exists but is only 32 bits large 13# Note: If the type 'long long int' exists but is only 32 bits large
14# (as on some very old compilers), HAVE_LONG_LONG_INT will not be 14# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
@@ -16,44 +16,48 @@ dnl From Paul Eggert.
16 16
17AC_DEFUN([AC_TYPE_LONG_LONG_INT], 17AC_DEFUN([AC_TYPE_LONG_LONG_INT],
18[ 18[
19 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
19 AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], 20 AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
20 [AC_LINK_IFELSE( 21 [ac_cv_type_long_long_int=yes
21 [_AC_TYPE_LONG_LONG_SNIPPET], 22 if test "x${ac_cv_prog_cc_c99-no}" = xno; then
22 [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. 23 ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int
23 dnl If cross compiling, assume the bug isn't important, since 24 if test $ac_cv_type_long_long_int = yes; then
24 dnl nobody cross compiles for this platform as far as we know. 25 dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
25 AC_RUN_IFELSE( 26 dnl If cross compiling, assume the bug is not important, since
26 [AC_LANG_PROGRAM( 27 dnl nobody cross compiles for this platform as far as we know.
27 [[@%:@include <limits.h> 28 AC_RUN_IFELSE(
28 @%:@ifndef LLONG_MAX 29 [AC_LANG_PROGRAM(
29 @%:@ define HALF \ 30 [[@%:@include <limits.h>
30 (1LL << (sizeof (long long int) * CHAR_BIT - 2)) 31 @%:@ifndef LLONG_MAX
31 @%:@ define LLONG_MAX (HALF - 1 + HALF) 32 @%:@ define HALF \
32 @%:@endif]], 33 (1LL << (sizeof (long long int) * CHAR_BIT - 2))
33 [[long long int n = 1; 34 @%:@ define LLONG_MAX (HALF - 1 + HALF)
34 int i; 35 @%:@endif]],
35 for (i = 0; ; i++) 36 [[long long int n = 1;
36 { 37 int i;
37 long long int m = n << i; 38 for (i = 0; ; i++)
38 if (m >> i != n) 39 {
39 return 1; 40 long long int m = n << i;
40 if (LLONG_MAX / 2 < m) 41 if (m >> i != n)
41 break; 42 return 1;
42 } 43 if (LLONG_MAX / 2 < m)
43 return 0;]])], 44 break;
44 [ac_cv_type_long_long_int=yes], 45 }
45 [ac_cv_type_long_long_int=no], 46 return 0;]])],
46 [ac_cv_type_long_long_int=yes])], 47 [],
47 [ac_cv_type_long_long_int=no])]) 48 [ac_cv_type_long_long_int=no],
49 [:])
50 fi
51 fi])
48 if test $ac_cv_type_long_long_int = yes; then 52 if test $ac_cv_type_long_long_int = yes; then
49 AC_DEFINE([HAVE_LONG_LONG_INT], [1], 53 AC_DEFINE([HAVE_LONG_LONG_INT], [1],
50 [Define to 1 if the system has the type `long long int'.]) 54 [Define to 1 if the system has the type 'long long int'.])
51 fi 55 fi
52]) 56])
53 57
54# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. 58# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
55# This fixes a bug in Autoconf 2.61, but can be removed once we 59# This fixes a bug in Autoconf 2.61, and can be faster
56# assume 2.62 everywhere. 60# than what's in Autoconf 2.62 through 2.68.
57 61
58# Note: If the type 'unsigned long long int' exists but is only 32 bits 62# Note: If the type 'unsigned long long int' exists but is only 32 bits
59# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT 63# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
@@ -64,13 +68,16 @@ AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
64[ 68[
65 AC_CACHE_CHECK([for unsigned long long int], 69 AC_CACHE_CHECK([for unsigned long long int],
66 [ac_cv_type_unsigned_long_long_int], 70 [ac_cv_type_unsigned_long_long_int],
67 [AC_LINK_IFELSE( 71 [ac_cv_type_unsigned_long_long_int=yes
68 [_AC_TYPE_LONG_LONG_SNIPPET], 72 if test "x${ac_cv_prog_cc_c99-no}" = xno; then
69 [ac_cv_type_unsigned_long_long_int=yes], 73 AC_LINK_IFELSE(
70 [ac_cv_type_unsigned_long_long_int=no])]) 74 [_AC_TYPE_LONG_LONG_SNIPPET],
75 [],
76 [ac_cv_type_unsigned_long_long_int=no])
77 fi])
71 if test $ac_cv_type_unsigned_long_long_int = yes; then 78 if test $ac_cv_type_unsigned_long_long_int = yes; then
72 AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], 79 AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
73 [Define to 1 if the system has the type `unsigned long long int'.]) 80 [Define to 1 if the system has the type 'unsigned long long int'.])
74 fi 81 fi
75]) 82])
76 83
diff --git a/gl/m4/ls-mntd-fs.m4 b/gl/m4/ls-mntd-fs.m4
index 40b9336..fb116c8 100644
--- a/gl/m4/ls-mntd-fs.m4
+++ b/gl/m4/ls-mntd-fs.m4
@@ -1,7 +1,7 @@
1# serial 28 1# serial 30
2# How to list mounted file systems. 2# How to list mounted file systems.
3 3
4# Copyright (C) 1998-2004, 2006, 2009-2010 Free Software Foundation, Inc. 4# Copyright (C) 1998-2004, 2006, 2009-2013 Free Software Foundation, Inc.
5# 5#
6# This file is free software; the Free Software Foundation 6# This file is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it, 7# gives unlimited permission to copy and/or distribute it,
@@ -70,7 +70,7 @@ AC_FUNC_GETMNTENT
70# with other getmntent implementations. 70# with other getmntent implementations.
71 71
72# NOTE: Normally, I wouldn't use a check for system type as I've done for 72# NOTE: Normally, I wouldn't use a check for system type as I've done for
73# `CRAY' below since that goes against the whole autoconf philosophy. But 73# 'CRAY' below since that goes against the whole autoconf philosophy. But
74# I think there is too great a chance that some non-Cray system has a 74# I think there is too great a chance that some non-Cray system has a
75# function named listmntent to risk the false positive. 75# function named listmntent to risk the false positive.
76 76
@@ -110,7 +110,7 @@ if test -z "$ac_list_mounted_fs"; then
110 AC_DEFINE([MOUNTED_VMOUNT], [1], 110 AC_DEFINE([MOUNTED_VMOUNT], [1],
111 [Define if there is a function named mntctl that can be used to read 111 [Define if there is a function named mntctl that can be used to read
112 the list of mounted file systems, and there is a system header file 112 the list of mounted file systems, and there is a system header file
113 that declares `struct vmount.' (AIX)]) 113 that declares 'struct vmount'. (AIX)])
114 fi 114 fi
115fi 115fi
116 116
@@ -247,7 +247,11 @@ if test -z "$ac_list_mounted_fs"; then
247#if HAVE_SYS_STATVFS_H 247#if HAVE_SYS_STATVFS_H
248# include <sys/statvfs.h> 248# include <sys/statvfs.h>
249#endif 249#endif
250extern int getmntinfo (struct statfs **, int); 250extern
251#ifdef __cplusplus
252"C"
253#endif
254int getmntinfo (struct statfs **, int);
251 ]], [])], 255 ]], [])],
252 [fu_cv_sys_mounted_getmntinfo2=no], 256 [fu_cv_sys_mounted_getmntinfo2=no],
253 [fu_cv_sys_mounted_getmntinfo2=yes]) 257 [fu_cv_sys_mounted_getmntinfo2=yes])
@@ -326,6 +330,23 @@ if test -z "$ac_list_mounted_fs"; then
326fi 330fi
327 331
328if test -z "$ac_list_mounted_fs"; then 332if test -z "$ac_list_mounted_fs"; then
333 # Interix / BSD alike statvfs
334 # the code is really interix specific, so make sure, we're on it.
335 case "$host" in
336 *-interix*)
337 AC_CHECK_FUNCS([statvfs])
338 if test $ac_cv_func_statvfs = yes; then
339 ac_list_mounted_fs=found
340 AC_DEFINE([MOUNTED_INTERIX_STATVFS], [1],
341 [Define if we are on interix, and ought to use statvfs plus
342 some special knowledge on where mounted file systems can be
343 found. (Interix)])
344 fi
345 ;;
346 esac
347fi
348
349if test -z "$ac_list_mounted_fs"; then
329 AC_MSG_ERROR([could not determine how to read list of mounted file systems]) 350 AC_MSG_ERROR([could not determine how to read list of mounted file systems])
330 # FIXME -- no need to abort building the whole package 351 # FIXME -- no need to abort building the whole package
331 # Can't build mountlist.c or anything that needs its functions 352 # Can't build mountlist.c or anything that needs its functions
diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4
index 910ac92..4b24a0b 100644
--- a/gl/m4/malloc.m4
+++ b/gl/m4/malloc.m4
@@ -1,25 +1,78 @@
1# malloc.m4 serial 9 1# malloc.m4 serial 14
2dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7m4_version_prereq([2.70], [] ,[
8
9# This is taken from the following Autoconf patch:
10# http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9
11AC_DEFUN([_AC_FUNC_MALLOC_IF],
12[
13 AC_REQUIRE([AC_HEADER_STDC])dnl
14 AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
15 AC_CHECK_HEADERS([stdlib.h])
16 AC_CACHE_CHECK([for GNU libc compatible malloc],
17 [ac_cv_func_malloc_0_nonnull],
18 [AC_RUN_IFELSE(
19 [AC_LANG_PROGRAM(
20 [[#if defined STDC_HEADERS || defined HAVE_STDLIB_H
21 # include <stdlib.h>
22 #else
23 char *malloc ();
24 #endif
25 ]],
26 [[return ! malloc (0);]])
27 ],
28 [ac_cv_func_malloc_0_nonnull=yes],
29 [ac_cv_func_malloc_0_nonnull=no],
30 [case "$host_os" in
31 # Guess yes on platforms where we know the result.
32 *-gnu* | freebsd* | netbsd* | openbsd* \
33 | hpux* | solaris* | cygwin* | mingw*)
34 ac_cv_func_malloc_0_nonnull=yes ;;
35 # If we don't know, assume the worst.
36 *) ac_cv_func_malloc_0_nonnull=no ;;
37 esac
38 ])
39 ])
40 AS_IF([test $ac_cv_func_malloc_0_nonnull = yes], [$1], [$2])
41])# _AC_FUNC_MALLOC_IF
42
43])
44
45# gl_FUNC_MALLOC_GNU
46# ------------------
47# Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if
48# it is not.
49AC_DEFUN([gl_FUNC_MALLOC_GNU],
50[
51 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
52 dnl _AC_FUNC_MALLOC_IF is defined in Autoconf.
53 _AC_FUNC_MALLOC_IF(
54 [AC_DEFINE([HAVE_MALLOC_GNU], [1],
55 [Define to 1 if your system has a GNU libc compatible 'malloc'
56 function, and to 0 otherwise.])],
57 [AC_DEFINE([HAVE_MALLOC_GNU], [0])
58 REPLACE_MALLOC=1
59 ])
60])
61
7# gl_FUNC_MALLOC_POSIX 62# gl_FUNC_MALLOC_POSIX
8# -------------------- 63# --------------------
9# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it 64# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it
10# fails), and replace malloc if it is not. 65# fails), and replace malloc if it is not.
11AC_DEFUN([gl_FUNC_MALLOC_POSIX], 66AC_DEFUN([gl_FUNC_MALLOC_POSIX],
12[ 67[
68 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
13 AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) 69 AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
14 if test $gl_cv_func_malloc_posix = yes; then 70 if test $gl_cv_func_malloc_posix = yes; then
15 HAVE_MALLOC_POSIX=1
16 AC_DEFINE([HAVE_MALLOC_POSIX], [1], 71 AC_DEFINE([HAVE_MALLOC_POSIX], [1],
17 [Define if the 'malloc' function is POSIX compliant.]) 72 [Define if the 'malloc' function is POSIX compliant.])
18 else 73 else
19 AC_LIBOBJ([malloc]) 74 REPLACE_MALLOC=1
20 HAVE_MALLOC_POSIX=0
21 fi 75 fi
22 AC_SUBST([HAVE_MALLOC_POSIX])
23]) 76])
24 77
25# Test whether malloc, realloc, calloc are POSIX compliant, 78# Test whether malloc, realloc, calloc are POSIX compliant,
@@ -32,10 +85,14 @@ AC_DEFUN([gl_CHECK_MALLOC_POSIX],
32 dnl It is too dangerous to try to allocate a large amount of memory: 85 dnl It is too dangerous to try to allocate a large amount of memory:
33 dnl some systems go to their knees when you do that. So assume that 86 dnl some systems go to their knees when you do that. So assume that
34 dnl all Unix implementations of the function are POSIX compliant. 87 dnl all Unix implementations of the function are POSIX compliant.
35 AC_TRY_COMPILE([], 88 AC_COMPILE_IFELSE(
36 [#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 89 [AC_LANG_PROGRAM(
37 choke me 90 [[]],
38 #endif 91 [[#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
39 ], [gl_cv_func_malloc_posix=yes], [gl_cv_func_malloc_posix=no]) 92 choke me
93 #endif
94 ]])],
95 [gl_cv_func_malloc_posix=yes],
96 [gl_cv_func_malloc_posix=no])
40 ]) 97 ])
41]) 98])
diff --git a/gl/m4/malloca.m4 b/gl/m4/malloca.m4
index e07c6d9..791ce10 100644
--- a/gl/m4/malloca.m4
+++ b/gl/m4/malloca.m4
@@ -1,5 +1,5 @@
1# malloca.m4 serial 1 1# malloca.m4 serial 1
2dnl Copyright (C) 2003-2004, 2006-2007, 2009-2010 Free Software Foundation, 2dnl Copyright (C) 2003-2004, 2006-2007, 2009-2013 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
diff --git a/gl/m4/math_h.m4 b/gl/m4/math_h.m4
index 2d89ca3..bf0845f 100644
--- a/gl/m4/math_h.m4
+++ b/gl/m4/math_h.m4
@@ -1,5 +1,5 @@
1# math_h.m4 serial 21 1# math_h.m4 serial 114
2dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -8,7 +8,6 @@ AC_DEFUN([gl_MATH_H],
8[ 8[
9 AC_REQUIRE([gl_MATH_H_DEFAULTS]) 9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
10 gl_CHECK_NEXT_HEADERS([math.h]) 10 gl_CHECK_NEXT_HEADERS([math.h])
11 AC_REQUIRE([AC_C_INLINE])
12 11
13 AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works], 12 AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works],
14 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]], 13 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]],
@@ -38,9 +37,20 @@ AC_DEFUN([gl_MATH_H],
38 37
39 dnl Check for declarations of anything we want to poison if the 38 dnl Check for declarations of anything we want to poison if the
40 dnl corresponding gnulib module is not in use. 39 dnl corresponding gnulib module is not in use.
41 gl_WARN_ON_USE_PREPARE([[#include <math.h> 40 gl_WARN_ON_USE_PREPARE([[#include <math.h>]],
42 ]], [acosl asinl atanl ceilf ceill cosl expl floorf floorl frexpl 41 [acosf acosl asinf asinl atanf atanl
43 ldexpl logb logl round roundf roundl sinl sqrtl tanl trunc truncf truncl]) 42 cbrt cbrtf cbrtl ceilf ceill copysign copysignf copysignl cosf cosl coshf
43 expf expl exp2 exp2f exp2l expm1 expm1f expm1l
44 fabsf fabsl floorf floorl fma fmaf fmal
45 fmod fmodf fmodl frexpf frexpl hypotf hypotl
46 ilogb ilogbf ilogbl
47 ldexpf ldexpl
48 log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l
49 logb logbf logbl
50 modf modff modfl powf
51 remainder remainderf remainderl
52 rint rintf rintl round roundf roundl sinf sinl sinhf sqrtf sqrtl
53 tanf tanl tanhf trunc truncf truncl])
44]) 54])
45 55
46AC_DEFUN([gl_MATH_MODULE_INDICATOR], 56AC_DEFUN([gl_MATH_MODULE_INDICATOR],
@@ -54,62 +64,189 @@ AC_DEFUN([gl_MATH_MODULE_INDICATOR],
54 64
55AC_DEFUN([gl_MATH_H_DEFAULTS], 65AC_DEFUN([gl_MATH_H_DEFAULTS],
56[ 66[
57 GNULIB_ACOSL=0; AC_SUBST([GNULIB_ACOSL]) 67 GNULIB_ACOSF=0; AC_SUBST([GNULIB_ACOSF])
58 GNULIB_ASINL=0; AC_SUBST([GNULIB_ASINL]) 68 GNULIB_ACOSL=0; AC_SUBST([GNULIB_ACOSL])
59 GNULIB_ATANL=0; AC_SUBST([GNULIB_ATANL]) 69 GNULIB_ASINF=0; AC_SUBST([GNULIB_ASINF])
60 GNULIB_CEILF=0; AC_SUBST([GNULIB_CEILF]) 70 GNULIB_ASINL=0; AC_SUBST([GNULIB_ASINL])
61 GNULIB_CEILL=0; AC_SUBST([GNULIB_CEILL]) 71 GNULIB_ATANF=0; AC_SUBST([GNULIB_ATANF])
62 GNULIB_COSL=0; AC_SUBST([GNULIB_COSL]) 72 GNULIB_ATANL=0; AC_SUBST([GNULIB_ATANL])
63 GNULIB_EXPL=0; AC_SUBST([GNULIB_EXPL]) 73 GNULIB_ATAN2F=0; AC_SUBST([GNULIB_ATAN2F])
64 GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF]) 74 GNULIB_CBRT=0; AC_SUBST([GNULIB_CBRT])
65 GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL]) 75 GNULIB_CBRTF=0; AC_SUBST([GNULIB_CBRTF])
66 GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP]) 76 GNULIB_CBRTL=0; AC_SUBST([GNULIB_CBRTL])
67 GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL]) 77 GNULIB_CEIL=0; AC_SUBST([GNULIB_CEIL])
68 GNULIB_ISFINITE=0; AC_SUBST([GNULIB_ISFINITE]) 78 GNULIB_CEILF=0; AC_SUBST([GNULIB_CEILF])
69 GNULIB_ISINF=0; AC_SUBST([GNULIB_ISINF]) 79 GNULIB_CEILL=0; AC_SUBST([GNULIB_CEILL])
70 GNULIB_ISNAN=0; AC_SUBST([GNULIB_ISNAN]) 80 GNULIB_COPYSIGN=0; AC_SUBST([GNULIB_COPYSIGN])
71 GNULIB_ISNANF=0; AC_SUBST([GNULIB_ISNANF]) 81 GNULIB_COPYSIGNF=0; AC_SUBST([GNULIB_COPYSIGNF])
72 GNULIB_ISNAND=0; AC_SUBST([GNULIB_ISNAND]) 82 GNULIB_COPYSIGNL=0; AC_SUBST([GNULIB_COPYSIGNL])
73 GNULIB_ISNANL=0; AC_SUBST([GNULIB_ISNANL]) 83 GNULIB_COSF=0; AC_SUBST([GNULIB_COSF])
74 GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL]) 84 GNULIB_COSL=0; AC_SUBST([GNULIB_COSL])
75 GNULIB_LOGB=0; AC_SUBST([GNULIB_LOGB]) 85 GNULIB_COSHF=0; AC_SUBST([GNULIB_COSHF])
76 GNULIB_LOGL=0; AC_SUBST([GNULIB_LOGL]) 86 GNULIB_EXPF=0; AC_SUBST([GNULIB_EXPF])
77 GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND]) 87 GNULIB_EXPL=0; AC_SUBST([GNULIB_EXPL])
78 GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF]) 88 GNULIB_EXP2=0; AC_SUBST([GNULIB_EXP2])
79 GNULIB_ROUNDL=0; AC_SUBST([GNULIB_ROUNDL]) 89 GNULIB_EXP2F=0; AC_SUBST([GNULIB_EXP2F])
80 GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT]) 90 GNULIB_EXP2L=0; AC_SUBST([GNULIB_EXP2L])
81 GNULIB_SINL=0; AC_SUBST([GNULIB_SINL]) 91 GNULIB_EXPM1=0; AC_SUBST([GNULIB_EXPM1])
82 GNULIB_SQRTL=0; AC_SUBST([GNULIB_SQRTL]) 92 GNULIB_EXPM1F=0; AC_SUBST([GNULIB_EXPM1F])
83 GNULIB_TANL=0; AC_SUBST([GNULIB_TANL]) 93 GNULIB_EXPM1L=0; AC_SUBST([GNULIB_EXPM1L])
84 GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC]) 94 GNULIB_FABSF=0; AC_SUBST([GNULIB_FABSF])
85 GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF]) 95 GNULIB_FABSL=0; AC_SUBST([GNULIB_FABSL])
86 GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL]) 96 GNULIB_FLOOR=0; AC_SUBST([GNULIB_FLOOR])
97 GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF])
98 GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL])
99 GNULIB_FMA=0; AC_SUBST([GNULIB_FMA])
100 GNULIB_FMAF=0; AC_SUBST([GNULIB_FMAF])
101 GNULIB_FMAL=0; AC_SUBST([GNULIB_FMAL])
102 GNULIB_FMOD=0; AC_SUBST([GNULIB_FMOD])
103 GNULIB_FMODF=0; AC_SUBST([GNULIB_FMODF])
104 GNULIB_FMODL=0; AC_SUBST([GNULIB_FMODL])
105 GNULIB_FREXPF=0; AC_SUBST([GNULIB_FREXPF])
106 GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP])
107 GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL])
108 GNULIB_HYPOT=0; AC_SUBST([GNULIB_HYPOT])
109 GNULIB_HYPOTF=0; AC_SUBST([GNULIB_HYPOTF])
110 GNULIB_HYPOTL=0; AC_SUBST([GNULIB_HYPOTL])
111 GNULIB_ILOGB=0; AC_SUBST([GNULIB_ILOGB])
112 GNULIB_ILOGBF=0; AC_SUBST([GNULIB_ILOGBF])
113 GNULIB_ILOGBL=0; AC_SUBST([GNULIB_ILOGBL])
114 GNULIB_ISFINITE=0; AC_SUBST([GNULIB_ISFINITE])
115 GNULIB_ISINF=0; AC_SUBST([GNULIB_ISINF])
116 GNULIB_ISNAN=0; AC_SUBST([GNULIB_ISNAN])
117 GNULIB_ISNANF=0; AC_SUBST([GNULIB_ISNANF])
118 GNULIB_ISNAND=0; AC_SUBST([GNULIB_ISNAND])
119 GNULIB_ISNANL=0; AC_SUBST([GNULIB_ISNANL])
120 GNULIB_LDEXPF=0; AC_SUBST([GNULIB_LDEXPF])
121 GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL])
122 GNULIB_LOG=0; AC_SUBST([GNULIB_LOG])
123 GNULIB_LOGF=0; AC_SUBST([GNULIB_LOGF])
124 GNULIB_LOGL=0; AC_SUBST([GNULIB_LOGL])
125 GNULIB_LOG10=0; AC_SUBST([GNULIB_LOG10])
126 GNULIB_LOG10F=0; AC_SUBST([GNULIB_LOG10F])
127 GNULIB_LOG10L=0; AC_SUBST([GNULIB_LOG10L])
128 GNULIB_LOG1P=0; AC_SUBST([GNULIB_LOG1P])
129 GNULIB_LOG1PF=0; AC_SUBST([GNULIB_LOG1PF])
130 GNULIB_LOG1PL=0; AC_SUBST([GNULIB_LOG1PL])
131 GNULIB_LOG2=0; AC_SUBST([GNULIB_LOG2])
132 GNULIB_LOG2F=0; AC_SUBST([GNULIB_LOG2F])
133 GNULIB_LOG2L=0; AC_SUBST([GNULIB_LOG2L])
134 GNULIB_LOGB=0; AC_SUBST([GNULIB_LOGB])
135 GNULIB_LOGBF=0; AC_SUBST([GNULIB_LOGBF])
136 GNULIB_LOGBL=0; AC_SUBST([GNULIB_LOGBL])
137 GNULIB_MODF=0; AC_SUBST([GNULIB_MODF])
138 GNULIB_MODFF=0; AC_SUBST([GNULIB_MODFF])
139 GNULIB_MODFL=0; AC_SUBST([GNULIB_MODFL])
140 GNULIB_POWF=0; AC_SUBST([GNULIB_POWF])
141 GNULIB_REMAINDER=0; AC_SUBST([GNULIB_REMAINDER])
142 GNULIB_REMAINDERF=0; AC_SUBST([GNULIB_REMAINDERF])
143 GNULIB_REMAINDERL=0; AC_SUBST([GNULIB_REMAINDERL])
144 GNULIB_RINT=0; AC_SUBST([GNULIB_RINT])
145 GNULIB_RINTF=0; AC_SUBST([GNULIB_RINTF])
146 GNULIB_RINTL=0; AC_SUBST([GNULIB_RINTL])
147 GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND])
148 GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF])
149 GNULIB_ROUNDL=0; AC_SUBST([GNULIB_ROUNDL])
150 GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT])
151 GNULIB_SINF=0; AC_SUBST([GNULIB_SINF])
152 GNULIB_SINL=0; AC_SUBST([GNULIB_SINL])
153 GNULIB_SINHF=0; AC_SUBST([GNULIB_SINHF])
154 GNULIB_SQRTF=0; AC_SUBST([GNULIB_SQRTF])
155 GNULIB_SQRTL=0; AC_SUBST([GNULIB_SQRTL])
156 GNULIB_TANF=0; AC_SUBST([GNULIB_TANF])
157 GNULIB_TANL=0; AC_SUBST([GNULIB_TANL])
158 GNULIB_TANHF=0; AC_SUBST([GNULIB_TANHF])
159 GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC])
160 GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF])
161 GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL])
87 dnl Assume proper GNU behavior unless another module says otherwise. 162 dnl Assume proper GNU behavior unless another module says otherwise.
163 HAVE_ACOSF=1; AC_SUBST([HAVE_ACOSF])
88 HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL]) 164 HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL])
165 HAVE_ASINF=1; AC_SUBST([HAVE_ASINF])
89 HAVE_ASINL=1; AC_SUBST([HAVE_ASINL]) 166 HAVE_ASINL=1; AC_SUBST([HAVE_ASINL])
167 HAVE_ATANF=1; AC_SUBST([HAVE_ATANF])
90 HAVE_ATANL=1; AC_SUBST([HAVE_ATANL]) 168 HAVE_ATANL=1; AC_SUBST([HAVE_ATANL])
169 HAVE_ATAN2F=1; AC_SUBST([HAVE_ATAN2F])
170 HAVE_CBRT=1; AC_SUBST([HAVE_CBRT])
171 HAVE_CBRTF=1; AC_SUBST([HAVE_CBRTF])
172 HAVE_CBRTL=1; AC_SUBST([HAVE_CBRTL])
173 HAVE_COPYSIGN=1; AC_SUBST([HAVE_COPYSIGN])
174 HAVE_COPYSIGNL=1; AC_SUBST([HAVE_COPYSIGNL])
175 HAVE_COSF=1; AC_SUBST([HAVE_COSF])
91 HAVE_COSL=1; AC_SUBST([HAVE_COSL]) 176 HAVE_COSL=1; AC_SUBST([HAVE_COSL])
177 HAVE_COSHF=1; AC_SUBST([HAVE_COSHF])
178 HAVE_EXPF=1; AC_SUBST([HAVE_EXPF])
92 HAVE_EXPL=1; AC_SUBST([HAVE_EXPL]) 179 HAVE_EXPL=1; AC_SUBST([HAVE_EXPL])
180 HAVE_EXPM1=1; AC_SUBST([HAVE_EXPM1])
181 HAVE_EXPM1F=1; AC_SUBST([HAVE_EXPM1F])
182 HAVE_FABSF=1; AC_SUBST([HAVE_FABSF])
183 HAVE_FABSL=1; AC_SUBST([HAVE_FABSL])
184 HAVE_FMA=1; AC_SUBST([HAVE_FMA])
185 HAVE_FMAF=1; AC_SUBST([HAVE_FMAF])
186 HAVE_FMAL=1; AC_SUBST([HAVE_FMAL])
187 HAVE_FMODF=1; AC_SUBST([HAVE_FMODF])
188 HAVE_FMODL=1; AC_SUBST([HAVE_FMODL])
189 HAVE_FREXPF=1; AC_SUBST([HAVE_FREXPF])
190 HAVE_HYPOTF=1; AC_SUBST([HAVE_HYPOTF])
191 HAVE_HYPOTL=1; AC_SUBST([HAVE_HYPOTL])
192 HAVE_ILOGB=1; AC_SUBST([HAVE_ILOGB])
193 HAVE_ILOGBF=1; AC_SUBST([HAVE_ILOGBF])
194 HAVE_ILOGBL=1; AC_SUBST([HAVE_ILOGBL])
93 HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF]) 195 HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF])
94 HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND]) 196 HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND])
95 HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL]) 197 HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL])
198 HAVE_LDEXPF=1; AC_SUBST([HAVE_LDEXPF])
199 HAVE_LOGF=1; AC_SUBST([HAVE_LOGF])
96 HAVE_LOGL=1; AC_SUBST([HAVE_LOGL]) 200 HAVE_LOGL=1; AC_SUBST([HAVE_LOGL])
201 HAVE_LOG10F=1; AC_SUBST([HAVE_LOG10F])
202 HAVE_LOG10L=1; AC_SUBST([HAVE_LOG10L])
203 HAVE_LOG1P=1; AC_SUBST([HAVE_LOG1P])
204 HAVE_LOG1PF=1; AC_SUBST([HAVE_LOG1PF])
205 HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL])
206 HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF])
207 HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL])
208 HAVE_MODFF=1; AC_SUBST([HAVE_MODFF])
209 HAVE_MODFL=1; AC_SUBST([HAVE_MODFL])
210 HAVE_POWF=1; AC_SUBST([HAVE_POWF])
211 HAVE_REMAINDER=1; AC_SUBST([HAVE_REMAINDER])
212 HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF])
213 HAVE_RINT=1; AC_SUBST([HAVE_RINT])
214 HAVE_RINTL=1; AC_SUBST([HAVE_RINTL])
215 HAVE_SINF=1; AC_SUBST([HAVE_SINF])
97 HAVE_SINL=1; AC_SUBST([HAVE_SINL]) 216 HAVE_SINL=1; AC_SUBST([HAVE_SINL])
217 HAVE_SINHF=1; AC_SUBST([HAVE_SINHF])
218 HAVE_SQRTF=1; AC_SUBST([HAVE_SQRTF])
98 HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL]) 219 HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL])
220 HAVE_TANF=1; AC_SUBST([HAVE_TANF])
99 HAVE_TANL=1; AC_SUBST([HAVE_TANL]) 221 HAVE_TANL=1; AC_SUBST([HAVE_TANL])
222 HAVE_TANHF=1; AC_SUBST([HAVE_TANHF])
100 HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) 223 HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL])
101 HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) 224 HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL])
102 HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) 225 HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL])
226 HAVE_DECL_CBRTF=1; AC_SUBST([HAVE_DECL_CBRTF])
227 HAVE_DECL_CBRTL=1; AC_SUBST([HAVE_DECL_CBRTL])
103 HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF]) 228 HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF])
104 HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL]) 229 HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL])
230 HAVE_DECL_COPYSIGNF=1; AC_SUBST([HAVE_DECL_COPYSIGNF])
105 HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) 231 HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL])
106 HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) 232 HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL])
233 HAVE_DECL_EXP2=1; AC_SUBST([HAVE_DECL_EXP2])
234 HAVE_DECL_EXP2F=1; AC_SUBST([HAVE_DECL_EXP2F])
235 HAVE_DECL_EXP2L=1; AC_SUBST([HAVE_DECL_EXP2L])
236 HAVE_DECL_EXPM1L=1; AC_SUBST([HAVE_DECL_EXPM1L])
107 HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF]) 237 HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF])
108 HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL]) 238 HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL])
109 HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) 239 HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL])
110 HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) 240 HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL])
111 HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB])
112 HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) 241 HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL])
242 HAVE_DECL_LOG10L=1; AC_SUBST([HAVE_DECL_LOG10L])
243 HAVE_DECL_LOG2=1; AC_SUBST([HAVE_DECL_LOG2])
244 HAVE_DECL_LOG2F=1; AC_SUBST([HAVE_DECL_LOG2F])
245 HAVE_DECL_LOG2L=1; AC_SUBST([HAVE_DECL_LOG2L])
246 HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB])
247 HAVE_DECL_REMAINDER=1; AC_SUBST([HAVE_DECL_REMAINDER])
248 HAVE_DECL_REMAINDERL=1; AC_SUBST([HAVE_DECL_REMAINDERL])
249 HAVE_DECL_RINTF=1; AC_SUBST([HAVE_DECL_RINTF])
113 HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND]) 250 HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND])
114 HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF]) 251 HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF])
115 HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL]) 252 HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL])
@@ -119,22 +256,98 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
119 HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC]) 256 HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC])
120 HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF]) 257 HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF])
121 HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL]) 258 HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL])
259 REPLACE_CBRTF=0; AC_SUBST([REPLACE_CBRTF])
260 REPLACE_CBRTL=0; AC_SUBST([REPLACE_CBRTL])
261 REPLACE_CEIL=0; AC_SUBST([REPLACE_CEIL])
122 REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) 262 REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF])
123 REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) 263 REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL])
264 REPLACE_EXPM1=0; AC_SUBST([REPLACE_EXPM1])
265 REPLACE_EXPM1F=0; AC_SUBST([REPLACE_EXPM1F])
266 REPLACE_EXP2=0; AC_SUBST([REPLACE_EXP2])
267 REPLACE_EXP2L=0; AC_SUBST([REPLACE_EXP2L])
268 REPLACE_FABSL=0; AC_SUBST([REPLACE_FABSL])
269 REPLACE_FLOOR=0; AC_SUBST([REPLACE_FLOOR])
124 REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF]) 270 REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF])
125 REPLACE_FLOORL=0; AC_SUBST([REPLACE_FLOORL]) 271 REPLACE_FLOORL=0; AC_SUBST([REPLACE_FLOORL])
272 REPLACE_FMA=0; AC_SUBST([REPLACE_FMA])
273 REPLACE_FMAF=0; AC_SUBST([REPLACE_FMAF])
274 REPLACE_FMAL=0; AC_SUBST([REPLACE_FMAL])
275 REPLACE_FMOD=0; AC_SUBST([REPLACE_FMOD])
276 REPLACE_FMODF=0; AC_SUBST([REPLACE_FMODF])
277 REPLACE_FMODL=0; AC_SUBST([REPLACE_FMODL])
278 REPLACE_FREXPF=0; AC_SUBST([REPLACE_FREXPF])
126 REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP]) 279 REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP])
127 REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) 280 REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL])
128 REPLACE_HUGE_VAL=0; AC_SUBST([REPLACE_HUGE_VAL]) 281 REPLACE_HUGE_VAL=0; AC_SUBST([REPLACE_HUGE_VAL])
282 REPLACE_HYPOT=0; AC_SUBST([REPLACE_HYPOT])
283 REPLACE_HYPOTF=0; AC_SUBST([REPLACE_HYPOTF])
284 REPLACE_HYPOTL=0; AC_SUBST([REPLACE_HYPOTL])
285 REPLACE_ILOGB=0; AC_SUBST([REPLACE_ILOGB])
286 REPLACE_ILOGBF=0; AC_SUBST([REPLACE_ILOGBF])
129 REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE]) 287 REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE])
130 REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF]) 288 REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF])
131 REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN]) 289 REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN])
132 REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) 290 REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL])
291 REPLACE_LOG=0; AC_SUBST([REPLACE_LOG])
292 REPLACE_LOGF=0; AC_SUBST([REPLACE_LOGF])
293 REPLACE_LOGL=0; AC_SUBST([REPLACE_LOGL])
294 REPLACE_LOG10=0; AC_SUBST([REPLACE_LOG10])
295 REPLACE_LOG10F=0; AC_SUBST([REPLACE_LOG10F])
296 REPLACE_LOG10L=0; AC_SUBST([REPLACE_LOG10L])
297 REPLACE_LOG1P=0; AC_SUBST([REPLACE_LOG1P])
298 REPLACE_LOG1PF=0; AC_SUBST([REPLACE_LOG1PF])
299 REPLACE_LOG1PL=0; AC_SUBST([REPLACE_LOG1PL])
300 REPLACE_LOG2=0; AC_SUBST([REPLACE_LOG2])
301 REPLACE_LOG2F=0; AC_SUBST([REPLACE_LOG2F])
302 REPLACE_LOG2L=0; AC_SUBST([REPLACE_LOG2L])
303 REPLACE_LOGB=0; AC_SUBST([REPLACE_LOGB])
304 REPLACE_LOGBF=0; AC_SUBST([REPLACE_LOGBF])
305 REPLACE_LOGBL=0; AC_SUBST([REPLACE_LOGBL])
306 REPLACE_MODF=0; AC_SUBST([REPLACE_MODF])
307 REPLACE_MODFF=0; AC_SUBST([REPLACE_MODFF])
308 REPLACE_MODFL=0; AC_SUBST([REPLACE_MODFL])
133 REPLACE_NAN=0; AC_SUBST([REPLACE_NAN]) 309 REPLACE_NAN=0; AC_SUBST([REPLACE_NAN])
310 REPLACE_REMAINDER=0; AC_SUBST([REPLACE_REMAINDER])
311 REPLACE_REMAINDERF=0; AC_SUBST([REPLACE_REMAINDERF])
312 REPLACE_REMAINDERL=0; AC_SUBST([REPLACE_REMAINDERL])
134 REPLACE_ROUND=0; AC_SUBST([REPLACE_ROUND]) 313 REPLACE_ROUND=0; AC_SUBST([REPLACE_ROUND])
135 REPLACE_ROUNDF=0; AC_SUBST([REPLACE_ROUNDF]) 314 REPLACE_ROUNDF=0; AC_SUBST([REPLACE_ROUNDF])
136 REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL]) 315 REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL])
137 REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT]) 316 REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT])
138 REPLACE_SIGNBIT_USING_GCC=0; AC_SUBST([REPLACE_SIGNBIT_USING_GCC]) 317 REPLACE_SIGNBIT_USING_GCC=0; AC_SUBST([REPLACE_SIGNBIT_USING_GCC])
318 REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL])
319 REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC])
320 REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF])
139 REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) 321 REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL])
140]) 322])
323
324# gl_LONG_DOUBLE_VS_DOUBLE
325# determines whether 'long double' and 'double' have the same representation.
326# Sets variable HAVE_SAME_LONG_DOUBLE_AS_DOUBLE to 0 or 1, and defines
327# HAVE_SAME_LONG_DOUBLE_AS_DOUBLE accordingly.
328# The currently known platforms where this is the case are:
329# Linux/HPPA, Minix 3.1.8, AIX 5, AIX 6 and 7 with xlc, MSVC 9.
330AC_DEFUN([gl_LONG_DOUBLE_VS_DOUBLE],
331[
332 AC_CACHE_CHECK([whether long double and double are the same],
333 [gl_cv_long_double_equals_double],
334 [AC_COMPILE_IFELSE(
335 [AC_LANG_PROGRAM([[#include <float.h>]],
336 [[typedef int check[sizeof (long double) == sizeof (double)
337 && LDBL_MANT_DIG == DBL_MANT_DIG
338 && LDBL_MAX_EXP == DBL_MAX_EXP
339 && LDBL_MIN_EXP == DBL_MIN_EXP
340 ? 1 : -1];
341 ]])],
342 [gl_cv_long_double_equals_double=yes],
343 [gl_cv_long_double_equals_double=no])
344 ])
345 if test $gl_cv_long_double_equals_double = yes; then
346 AC_DEFINE([HAVE_SAME_LONG_DOUBLE_AS_DOUBLE], [1],
347 [Define to 1 if 'long double' and 'double' have the same representation.])
348 HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=1
349 else
350 HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=0
351 fi
352 AC_SUBST([HAVE_SAME_LONG_DOUBLE_AS_DOUBLE])
353])
diff --git a/gl/m4/mbrtowc.m4 b/gl/m4/mbrtowc.m4
index 606de5c..4c9f388 100644
--- a/gl/m4/mbrtowc.m4
+++ b/gl/m4/mbrtowc.m4
@@ -1,5 +1,5 @@
1# mbrtowc.m4 serial 17 1# mbrtowc.m4 serial 25
2dnl Copyright (C) 2001-2002, 2004-2005, 2008-2010 Free Software Foundation, 2dnl Copyright (C) 2001-2002, 2004-2005, 2008-2013 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -15,16 +15,40 @@ AC_DEFUN([gl_FUNC_MBRTOWC],
15 AC_CHECK_FUNCS_ONCE([mbrtowc]) 15 AC_CHECK_FUNCS_ONCE([mbrtowc])
16 if test $ac_cv_func_mbrtowc = no; then 16 if test $ac_cv_func_mbrtowc = no; then
17 HAVE_MBRTOWC=0 17 HAVE_MBRTOWC=0
18 AC_CHECK_DECLS([mbrtowc],,, [[
19/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
20 <wchar.h>.
21 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
22 included before <wchar.h>. */
23#include <stddef.h>
24#include <stdio.h>
25#include <time.h>
26#include <wchar.h>
27]])
28 if test $ac_cv_have_decl_mbrtowc = yes; then
29 dnl On Minix 3.1.8, the system's <wchar.h> declares mbrtowc() although
30 dnl it does not have the function. Avoid a collision with gnulib's
31 dnl replacement.
32 REPLACE_MBRTOWC=1
33 fi
18 else 34 else
19 if test $REPLACE_MBSTATE_T = 1; then 35 if test $REPLACE_MBSTATE_T = 1; then
20 REPLACE_MBRTOWC=1 36 REPLACE_MBRTOWC=1
21 else 37 else
22 gl_MBRTOWC_NULL_ARG 38 gl_MBRTOWC_NULL_ARG1
39 gl_MBRTOWC_NULL_ARG2
23 gl_MBRTOWC_RETVAL 40 gl_MBRTOWC_RETVAL
24 gl_MBRTOWC_NUL_RETVAL 41 gl_MBRTOWC_NUL_RETVAL
25 case "$gl_cv_func_mbrtowc_null_arg" in 42 case "$gl_cv_func_mbrtowc_null_arg1" in
43 *yes) ;;
44 *) AC_DEFINE([MBRTOWC_NULL_ARG1_BUG], [1],
45 [Define if the mbrtowc function has the NULL pwc argument bug.])
46 REPLACE_MBRTOWC=1
47 ;;
48 esac
49 case "$gl_cv_func_mbrtowc_null_arg2" in
26 *yes) ;; 50 *yes) ;;
27 *) AC_DEFINE([MBRTOWC_NULL_ARG_BUG], [1], 51 *) AC_DEFINE([MBRTOWC_NULL_ARG2_BUG], [1],
28 [Define if the mbrtowc function has the NULL string argument bug.]) 52 [Define if the mbrtowc function has the NULL string argument bug.])
29 REPLACE_MBRTOWC=1 53 REPLACE_MBRTOWC=1
30 ;; 54 ;;
@@ -45,11 +69,6 @@ AC_DEFUN([gl_FUNC_MBRTOWC],
45 esac 69 esac
46 fi 70 fi
47 fi 71 fi
48 if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then
49 gl_REPLACE_WCHAR_H
50 AC_LIBOBJ([mbrtowc])
51 gl_PREREQ_MBRTOWC
52 fi
53]) 72])
54 73
55dnl Test whether mbsinit() and mbrtowc() need to be overridden in a way that 74dnl Test whether mbsinit() and mbrtowc() need to be overridden in a way that
@@ -80,9 +99,6 @@ AC_DEFUN([gl_MBSTATE_T_BROKEN],
80 else 99 else
81 REPLACE_MBSTATE_T=1 100 REPLACE_MBSTATE_T=1
82 fi 101 fi
83 if test $REPLACE_MBSTATE_T = 1; then
84 gl_REPLACE_WCHAR_H
85 fi
86]) 102])
87 103
88dnl Test whether mbrtowc puts the state into non-initial state when parsing an 104dnl Test whether mbrtowc puts the state into non-initial state when parsing an
@@ -101,16 +117,24 @@ AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE],
101 dnl is present. 117 dnl is present.
102changequote(,)dnl 118changequote(,)dnl
103 case "$host_os" in 119 case "$host_os" in
104 # Guess no on AIX and OSF/1. 120 # Guess no on AIX and OSF/1.
105 osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; 121 aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;;
106 # Guess yes otherwise. 122 # Guess yes otherwise.
107 *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; 123 *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;;
108 esac 124 esac
109changequote([,])dnl 125changequote([,])dnl
110 if test $LOCALE_JA != none; then 126 if test $LOCALE_JA != none; then
111 AC_TRY_RUN([ 127 AC_RUN_IFELSE(
128 [AC_LANG_SOURCE([[
112#include <locale.h> 129#include <locale.h>
113#include <string.h> 130#include <string.h>
131/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
132 <wchar.h>.
133 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
134 included before <wchar.h>. */
135#include <stddef.h>
136#include <stdio.h>
137#include <time.h>
114#include <wchar.h> 138#include <wchar.h>
115int main () 139int main ()
116{ 140{
@@ -126,7 +150,7 @@ int main ()
126 return 1; 150 return 1;
127 } 151 }
128 return 0; 152 return 0;
129}], 153}]])],
130 [gl_cv_func_mbrtowc_incomplete_state=yes], 154 [gl_cv_func_mbrtowc_incomplete_state=yes],
131 [gl_cv_func_mbrtowc_incomplete_state=no], 155 [gl_cv_func_mbrtowc_incomplete_state=no],
132 [:]) 156 [:])
@@ -156,10 +180,18 @@ changequote(,)dnl
156 esac 180 esac
157changequote([,])dnl 181changequote([,])dnl
158 if test $LOCALE_ZH_CN != none; then 182 if test $LOCALE_ZH_CN != none; then
159 AC_TRY_RUN([ 183 AC_RUN_IFELSE(
184 [AC_LANG_SOURCE([[
160#include <locale.h> 185#include <locale.h>
161#include <stdlib.h> 186#include <stdlib.h>
162#include <string.h> 187#include <string.h>
188/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
189 <wchar.h>.
190 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
191 included before <wchar.h>. */
192#include <stddef.h>
193#include <stdio.h>
194#include <time.h>
163#include <wchar.h> 195#include <wchar.h>
164int main () 196int main ()
165{ 197{
@@ -178,7 +210,7 @@ int main ()
178 return 1; 210 return 1;
179 } 211 }
180 return 0; 212 return 0;
181}], 213}]])],
182 [gl_cv_func_mbrtowc_sanitycheck=yes], 214 [gl_cv_func_mbrtowc_sanitycheck=yes],
183 [gl_cv_func_mbrtowc_sanitycheck=no], 215 [gl_cv_func_mbrtowc_sanitycheck=no],
184 [:]) 216 [:])
@@ -186,31 +218,109 @@ int main ()
186 ]) 218 ])
187]) 219])
188 220
221dnl Test whether mbrtowc supports a NULL pwc argument correctly.
222dnl Result is gl_cv_func_mbrtowc_null_arg1.
223
224AC_DEFUN([gl_MBRTOWC_NULL_ARG1],
225[
226 AC_REQUIRE([AC_PROG_CC])
227 AC_REQUIRE([gt_LOCALE_FR_UTF8])
228 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
229 AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument],
230 [gl_cv_func_mbrtowc_null_arg1],
231 [
232 dnl Initial guess, used when cross-compiling or when no suitable locale
233 dnl is present.
234changequote(,)dnl
235 case "$host_os" in
236 # Guess no on Solaris.
237 solaris*) gl_cv_func_mbrtowc_null_arg1="guessing no" ;;
238 # Guess yes otherwise.
239 *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;;
240 esac
241changequote([,])dnl
242 if test $LOCALE_FR_UTF8 != none; then
243 AC_RUN_IFELSE(
244 [AC_LANG_SOURCE([[
245#include <locale.h>
246#include <stdlib.h>
247#include <string.h>
248/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
249 <wchar.h>.
250 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
251 included before <wchar.h>. */
252#include <stddef.h>
253#include <stdio.h>
254#include <time.h>
255#include <wchar.h>
256int main ()
257{
258 int result = 0;
259
260 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
261 {
262 char input[] = "\303\237er";
263 mbstate_t state;
264 wchar_t wc;
265 size_t ret;
266
267 memset (&state, '\0', sizeof (mbstate_t));
268 wc = (wchar_t) 0xBADFACE;
269 ret = mbrtowc (&wc, input, 5, &state);
270 if (ret != 2)
271 result |= 1;
272 if (!mbsinit (&state))
273 result |= 2;
274
275 memset (&state, '\0', sizeof (mbstate_t));
276 ret = mbrtowc (NULL, input, 5, &state);
277 if (ret != 2) /* Solaris 7 fails here: ret is -1. */
278 result |= 4;
279 if (!mbsinit (&state))
280 result |= 8;
281 }
282 return result;
283}]])],
284 [gl_cv_func_mbrtowc_null_arg1=yes],
285 [gl_cv_func_mbrtowc_null_arg1=no],
286 [:])
287 fi
288 ])
289])
290
189dnl Test whether mbrtowc supports a NULL string argument correctly. 291dnl Test whether mbrtowc supports a NULL string argument correctly.
190dnl Result is gl_cv_func_mbrtowc_null_arg. 292dnl Result is gl_cv_func_mbrtowc_null_arg2.
191 293
192AC_DEFUN([gl_MBRTOWC_NULL_ARG], 294AC_DEFUN([gl_MBRTOWC_NULL_ARG2],
193[ 295[
194 AC_REQUIRE([AC_PROG_CC]) 296 AC_REQUIRE([AC_PROG_CC])
195 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 297 AC_REQUIRE([gt_LOCALE_FR_UTF8])
196 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 298 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
197 AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument], 299 AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument],
198 [gl_cv_func_mbrtowc_null_arg], 300 [gl_cv_func_mbrtowc_null_arg2],
199 [ 301 [
200 dnl Initial guess, used when cross-compiling or when no suitable locale 302 dnl Initial guess, used when cross-compiling or when no suitable locale
201 dnl is present. 303 dnl is present.
202changequote(,)dnl 304changequote(,)dnl
203 case "$host_os" in 305 case "$host_os" in
204 # Guess no on OSF/1. 306 # Guess no on OSF/1.
205 osf*) gl_cv_func_mbrtowc_null_arg="guessing no" ;; 307 osf*) gl_cv_func_mbrtowc_null_arg2="guessing no" ;;
206 # Guess yes otherwise. 308 # Guess yes otherwise.
207 *) gl_cv_func_mbrtowc_null_arg="guessing yes" ;; 309 *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;;
208 esac 310 esac
209changequote([,])dnl 311changequote([,])dnl
210 if test $LOCALE_FR_UTF8 != none; then 312 if test $LOCALE_FR_UTF8 != none; then
211 AC_TRY_RUN([ 313 AC_RUN_IFELSE(
314 [AC_LANG_SOURCE([[
212#include <locale.h> 315#include <locale.h>
213#include <string.h> 316#include <string.h>
317/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
318 <wchar.h>.
319 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
320 included before <wchar.h>. */
321#include <stddef.h>
322#include <stdio.h>
323#include <time.h>
214#include <wchar.h> 324#include <wchar.h>
215int main () 325int main ()
216{ 326{
@@ -228,7 +338,10 @@ int main ()
228 return 1; 338 return 1;
229 } 339 }
230 return 0; 340 return 0;
231}], [gl_cv_func_mbrtowc_null_arg=yes], [gl_cv_func_mbrtowc_null_arg=no], [:]) 341}]])],
342 [gl_cv_func_mbrtowc_null_arg2=yes],
343 [gl_cv_func_mbrtowc_null_arg2=no],
344 [:])
232 fi 345 fi
233 ]) 346 ])
234]) 347])
@@ -243,7 +356,7 @@ AC_DEFUN([gl_MBRTOWC_RETVAL],
243 AC_REQUIRE([AC_PROG_CC]) 356 AC_REQUIRE([AC_PROG_CC])
244 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 357 AC_REQUIRE([gt_LOCALE_FR_UTF8])
245 AC_REQUIRE([gt_LOCALE_JA]) 358 AC_REQUIRE([gt_LOCALE_JA])
246 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 359 AC_REQUIRE([AC_CANONICAL_HOST])
247 AC_CACHE_CHECK([whether mbrtowc has a correct return value], 360 AC_CACHE_CHECK([whether mbrtowc has a correct return value],
248 [gl_cv_func_mbrtowc_retval], 361 [gl_cv_func_mbrtowc_retval],
249 [ 362 [
@@ -251,19 +364,30 @@ AC_DEFUN([gl_MBRTOWC_RETVAL],
251 dnl is present. 364 dnl is present.
252changequote(,)dnl 365changequote(,)dnl
253 case "$host_os" in 366 case "$host_os" in
254 # Guess no on HP-UX and Solaris. 367 # Guess no on HP-UX, Solaris, native Windows.
255 hpux* | solaris*) gl_cv_func_mbrtowc_retval="guessing no" ;; 368 hpux* | solaris* | mingw*) gl_cv_func_mbrtowc_retval="guessing no" ;;
256 # Guess yes otherwise. 369 # Guess yes otherwise.
257 *) gl_cv_func_mbrtowc_retval="guessing yes" ;; 370 *) gl_cv_func_mbrtowc_retval="guessing yes" ;;
258 esac 371 esac
259changequote([,])dnl 372changequote([,])dnl
260 if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none; then 373 if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \
261 AC_TRY_RUN([ 374 || { case "$host_os" in mingw*) true;; *) false;; esac; }; then
375 AC_RUN_IFELSE(
376 [AC_LANG_SOURCE([[
262#include <locale.h> 377#include <locale.h>
263#include <string.h> 378#include <string.h>
379/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
380 <wchar.h>.
381 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
382 included before <wchar.h>. */
383#include <stddef.h>
384#include <stdio.h>
385#include <time.h>
264#include <wchar.h> 386#include <wchar.h>
265int main () 387int main ()
266{ 388{
389 int result = 0;
390 int found_some_locale = 0;
267 /* This fails on Solaris. */ 391 /* This fails on Solaris. */
268 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 392 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
269 { 393 {
@@ -276,8 +400,9 @@ int main ()
276 { 400 {
277 input[1] = '\0'; 401 input[1] = '\0';
278 if (mbrtowc (&wc, input + 2, 5, &state) != 1) 402 if (mbrtowc (&wc, input + 2, 5, &state) != 1)
279 return 1; 403 result |= 1;
280 } 404 }
405 found_some_locale = 1;
281 } 406 }
282 /* This fails on HP-UX 11.11. */ 407 /* This fails on HP-UX 11.11. */
283 if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) 408 if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
@@ -291,13 +416,63 @@ int main ()
291 { 416 {
292 input[1] = '\0'; 417 input[1] = '\0';
293 if (mbrtowc (&wc, input + 2, 5, &state) != 2) 418 if (mbrtowc (&wc, input + 2, 5, &state) != 2)
294 return 1; 419 result |= 2;
295 } 420 }
421 found_some_locale = 1;
296 } 422 }
297 return 0; 423 /* This fails on native Windows. */
298}], 424 if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL)
425 {
426 char input[] = "<\223\372\226\173\214\352>"; /* "<日本語>" */
427 mbstate_t state;
428 wchar_t wc;
429
430 memset (&state, '\0', sizeof (mbstate_t));
431 if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2))
432 {
433 input[3] = '\0';
434 if (mbrtowc (&wc, input + 4, 4, &state) != 1)
435 result |= 4;
436 }
437 found_some_locale = 1;
438 }
439 if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL)
440 {
441 char input[] = "<\244\351\245\273\273\171>"; /* "<日本語>" */
442 mbstate_t state;
443 wchar_t wc;
444
445 memset (&state, '\0', sizeof (mbstate_t));
446 if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2))
447 {
448 input[3] = '\0';
449 if (mbrtowc (&wc, input + 4, 4, &state) != 1)
450 result |= 8;
451 }
452 found_some_locale = 1;
453 }
454 if (setlocale (LC_ALL, "Chinese_China.936") != NULL)
455 {
456 char input[] = "<\310\325\261\276\325\132>"; /* "<日本語>" */
457 mbstate_t state;
458 wchar_t wc;
459
460 memset (&state, '\0', sizeof (mbstate_t));
461 if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2))
462 {
463 input[3] = '\0';
464 if (mbrtowc (&wc, input + 4, 4, &state) != 1)
465 result |= 16;
466 }
467 found_some_locale = 1;
468 }
469 return (found_some_locale ? result : 77);
470}]])],
299 [gl_cv_func_mbrtowc_retval=yes], 471 [gl_cv_func_mbrtowc_retval=yes],
300 [gl_cv_func_mbrtowc_retval=no], 472 [if test $? != 77; then
473 gl_cv_func_mbrtowc_retval=no
474 fi
475 ],
301 [:]) 476 [:])
302 fi 477 fi
303 ]) 478 ])
@@ -325,9 +500,17 @@ changequote(,)dnl
325 esac 500 esac
326changequote([,])dnl 501changequote([,])dnl
327 if test $LOCALE_ZH_CN != none; then 502 if test $LOCALE_ZH_CN != none; then
328 AC_TRY_RUN([ 503 AC_RUN_IFELSE(
504 [AC_LANG_SOURCE([[
329#include <locale.h> 505#include <locale.h>
330#include <string.h> 506#include <string.h>
507/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
508 <wchar.h>.
509 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
510 included before <wchar.h>. */
511#include <stddef.h>
512#include <stdio.h>
513#include <time.h>
331#include <wchar.h> 514#include <wchar.h>
332int main () 515int main ()
333{ 516{
@@ -342,7 +525,7 @@ int main ()
342 return 1; 525 return 1;
343 } 526 }
344 return 0; 527 return 0;
345}], 528}]])],
346 [gl_cv_func_mbrtowc_nul_retval=yes], 529 [gl_cv_func_mbrtowc_nul_retval=yes],
347 [gl_cv_func_mbrtowc_nul_retval=no], 530 [gl_cv_func_mbrtowc_nul_retval=no],
348 [:]) 531 [:])
@@ -358,10 +541,8 @@ AC_DEFUN([gl_PREREQ_MBRTOWC], [
358 541
359dnl From Paul Eggert 542dnl From Paul Eggert
360 543
361dnl This override of an autoconf macro can be removed when autoconf 2.60 or 544dnl This is an override of an autoconf macro.
362dnl newer can be assumed everywhere.
363 545
364m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.60]),[-1],[
365AC_DEFUN([AC_FUNC_MBRTOWC], 546AC_DEFUN([AC_FUNC_MBRTOWC],
366[ 547[
367 dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60. 548 dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60.
@@ -369,7 +550,14 @@ AC_DEFUN([AC_FUNC_MBRTOWC],
369 gl_cv_func_mbrtowc, 550 gl_cv_func_mbrtowc,
370 [AC_LINK_IFELSE( 551 [AC_LINK_IFELSE(
371 [AC_LANG_PROGRAM( 552 [AC_LANG_PROGRAM(
372 [[#include <wchar.h>]], 553 [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be
554 included before <wchar.h>.
555 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h>
556 must be included before <wchar.h>. */
557 #include <stddef.h>
558 #include <stdio.h>
559 #include <time.h>
560 #include <wchar.h>]],
373 [[wchar_t wc; 561 [[wchar_t wc;
374 char const s[] = ""; 562 char const s[] = "";
375 size_t n = 1; 563 size_t n = 1;
@@ -382,4 +570,3 @@ AC_DEFUN([AC_FUNC_MBRTOWC],
382 [Define to 1 if mbrtowc and mbstate_t are properly declared.]) 570 [Define to 1 if mbrtowc and mbstate_t are properly declared.])
383 fi 571 fi
384]) 572])
385])
diff --git a/gl/m4/mbsinit.m4 b/gl/m4/mbsinit.m4
index 46c106f..2e6d092 100644
--- a/gl/m4/mbsinit.m4
+++ b/gl/m4/mbsinit.m4
@@ -1,5 +1,5 @@
1# mbsinit.m4 serial 4 1# mbsinit.m4 serial 8
2dnl Copyright (C) 2008, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2008, 2010-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
7AC_DEFUN([gl_FUNC_MBSINIT], 7AC_DEFUN([gl_FUNC_MBSINIT],
8[ 8[
9 AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) 9 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
10 AC_REQUIRE([AC_CANONICAL_HOST])
10 11
11 AC_REQUIRE([AC_TYPE_MBSTATE_T]) 12 AC_REQUIRE([AC_TYPE_MBSTATE_T])
12 gl_MBSTATE_T_BROKEN 13 gl_MBSTATE_T_BROKEN
@@ -14,16 +15,34 @@ AC_DEFUN([gl_FUNC_MBSINIT],
14 AC_CHECK_FUNCS_ONCE([mbsinit]) 15 AC_CHECK_FUNCS_ONCE([mbsinit])
15 if test $ac_cv_func_mbsinit = no; then 16 if test $ac_cv_func_mbsinit = no; then
16 HAVE_MBSINIT=0 17 HAVE_MBSINIT=0
18 AC_CHECK_DECLS([mbsinit],,, [[
19/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
20 <wchar.h>.
21 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
22 included before <wchar.h>. */
23#include <stddef.h>
24#include <stdio.h>
25#include <time.h>
26#include <wchar.h>
27]])
28 if test $ac_cv_have_decl_mbsinit = yes; then
29 dnl On Minix 3.1.8, the system's <wchar.h> declares mbsinit() although
30 dnl it does not have the function. Avoid a collision with gnulib's
31 dnl replacement.
32 REPLACE_MBSINIT=1
33 fi
17 else 34 else
18 if test $REPLACE_MBSTATE_T = 1; then 35 if test $REPLACE_MBSTATE_T = 1; then
19 REPLACE_MBSINIT=1 36 REPLACE_MBSINIT=1
37 else
38 dnl On mingw, mbsinit() always returns 1, which is inappropriate for
39 dnl states produced by mbrtowc() for an incomplete multibyte character
40 dnl in multibyte locales.
41 case "$host_os" in
42 mingw*) REPLACE_MBSINIT=1 ;;
43 esac
20 fi 44 fi
21 fi 45 fi
22 if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then
23 gl_REPLACE_WCHAR_H
24 AC_LIBOBJ([mbsinit])
25 gl_PREREQ_MBSINIT
26 fi
27]) 46])
28 47
29# Prerequisites of lib/mbsinit.c. 48# Prerequisites of lib/mbsinit.c.
diff --git a/gl/m4/mbstate_t.m4 b/gl/m4/mbstate_t.m4
index 3e2df29..ed00117 100644
--- a/gl/m4/mbstate_t.m4
+++ b/gl/m4/mbstate_t.m4
@@ -1,5 +1,5 @@
1# mbstate_t.m4 serial 12 1# mbstate_t.m4 serial 13
2dnl Copyright (C) 2000-2002, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -20,7 +20,14 @@ AC_DEFUN([AC_TYPE_MBSTATE_T],
20 [AC_COMPILE_IFELSE( 20 [AC_COMPILE_IFELSE(
21 [AC_LANG_PROGRAM( 21 [AC_LANG_PROGRAM(
22 [AC_INCLUDES_DEFAULT[ 22 [AC_INCLUDES_DEFAULT[
23# include <wchar.h>]], 23/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
24 <wchar.h>.
25 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
26 included before <wchar.h>. */
27#include <stddef.h>
28#include <stdio.h>
29#include <time.h>
30#include <wchar.h>]],
24 [[mbstate_t x; return sizeof x;]])], 31 [[mbstate_t x; return sizeof x;]])],
25 [ac_cv_type_mbstate_t=yes], 32 [ac_cv_type_mbstate_t=yes],
26 [ac_cv_type_mbstate_t=no])]) 33 [ac_cv_type_mbstate_t=no])])
diff --git a/gl/m4/mbtowc.m4 b/gl/m4/mbtowc.m4
new file mode 100644
index 0000000..e479461
--- /dev/null
+++ b/gl/m4/mbtowc.m4
@@ -0,0 +1,19 @@
1# mbtowc.m4 serial 2
2dnl Copyright (C) 2011-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_MBTOWC],
8[
9 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
10
11 if false; then
12 REPLACE_MBTOWC=1
13 fi
14])
15
16# Prerequisites of lib/mbtowc.c.
17AC_DEFUN([gl_PREREQ_MBTOWC], [
18 :
19])
diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4
index ab773b8..2d8abe7 100644
--- a/gl/m4/memchr.m4
+++ b/gl/m4/memchr.m4
@@ -1,5 +1,5 @@
1# memchr.m4 serial 8 1# memchr.m4 serial 12
2dnl Copyright (C) 2002-2004, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2004, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -11,10 +11,16 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
11 AC_CHECK_HEADERS_ONCE([sys/mman.h]) 11 AC_CHECK_HEADERS_ONCE([sys/mman.h])
12 AC_CHECK_FUNCS_ONCE([mprotect]) 12 AC_CHECK_FUNCS_ONCE([mprotect])
13 13
14 dnl These days, we assume memchr is present. But just in case...
15 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) 14 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
16 AC_CHECK_FUNCS_ONCE([memchr]) 15 m4_ifdef([gl_FUNC_MEMCHR_OBSOLETE], [
17 if test $ac_cv_func_memchr = yes; then 16 dnl These days, we assume memchr is present. But if support for old
17 dnl platforms is desired:
18 AC_CHECK_FUNCS_ONCE([memchr])
19 if test $ac_cv_func_memchr = no; then
20 HAVE_MEMCHR=0
21 fi
22 ])
23 if test $HAVE_MEMCHR = 1; then
18 # Detect platform-specific bugs in some versions of glibc: 24 # Detect platform-specific bugs in some versions of glibc:
19 # memchr should not dereference anything with length 0 25 # memchr should not dereference anything with length 0
20 # http://bugzilla.redhat.com/499689 26 # http://bugzilla.redhat.com/499689
@@ -35,6 +41,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
35# endif 41# endif
36#endif 42#endif
37]], [[ 43]], [[
44 int result = 0;
38 char *fence = NULL; 45 char *fence = NULL;
39#if HAVE_SYS_MMAN_H && HAVE_MPROTECT 46#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
40# if HAVE_MAP_ANONYMOUS 47# if HAVE_MAP_ANONYMOUS
@@ -58,24 +65,20 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
58 if (fence) 65 if (fence)
59 { 66 {
60 if (memchr (fence, 0, 0)) 67 if (memchr (fence, 0, 0))
61 return 1; 68 result |= 1;
62 strcpy (fence - 9, "12345678"); 69 strcpy (fence - 9, "12345678");
63 if (memchr (fence - 9, 0, 79) != fence - 1) 70 if (memchr (fence - 9, 0, 79) != fence - 1)
64 return 2; 71 result |= 2;
72 if (memchr (fence - 1, 0, 3) != fence - 1)
73 result |= 4;
65 } 74 }
66 return 0; 75 return result;
67]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no], 76]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no],
68 [dnl Be pessimistic for now. 77 [dnl Be pessimistic for now.
69 gl_cv_func_memchr_works="guessing no"])]) 78 gl_cv_func_memchr_works="guessing no"])])
70 if test "$gl_cv_func_memchr_works" != yes; then 79 if test "$gl_cv_func_memchr_works" != yes; then
71 REPLACE_MEMCHR=1 80 REPLACE_MEMCHR=1
72 fi 81 fi
73 else
74 HAVE_MEMCHR=0
75 fi
76 if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
77 AC_LIBOBJ([memchr])
78 gl_PREREQ_MEMCHR
79 fi 82 fi
80]) 83])
81 84
diff --git a/gl/m4/mktime.m4 b/gl/m4/mktime.m4
index 44b8d87..faefb77 100644
--- a/gl/m4/mktime.m4
+++ b/gl/m4/mktime.m4
@@ -1,5 +1,5 @@
1# serial 15 1# serial 25
2dnl Copyright (C) 2002-2003, 2005-2007, 2009-2010 Free Software Foundation, 2dnl Copyright (C) 2002-2003, 2005-2007, 2009-2013 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -7,24 +7,24 @@ dnl with or without modifications, as long as this notice is preserved.
7 7
8dnl From Jim Meyering. 8dnl From Jim Meyering.
9 9
10# Redefine AC_FUNC_MKTIME, to fix a bug in Autoconf 2.61a and earlier. 10AC_DEFUN([gl_FUNC_MKTIME],
11# This redefinition can be removed once a new version of Autoconf is assumed. 11[
12# The redefinition is taken from 12 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
13# <http://cvs.sv.gnu.org/viewcvs/*checkout*/autoconf/autoconf/lib/autoconf/functions.m4?rev=1.119>. 13
14# AC_FUNC_MKTIME 14 dnl We don't use AC_FUNC_MKTIME any more, because it is no longer maintained
15# -------------- 15 dnl in Autoconf and because it invokes AC_LIBOBJ.
16AC_DEFUN([AC_FUNC_MKTIME], 16 AC_CHECK_HEADERS_ONCE([unistd.h])
17[AC_CHECK_HEADERS_ONCE([unistd.h]) 17 AC_CHECK_DECLS_ONCE([alarm])
18AC_CHECK_FUNCS_ONCE([alarm]) 18 AC_REQUIRE([gl_MULTIARCH])
19AC_REQUIRE([gl_MULTIARCH]) 19 if test $APPLE_UNIVERSAL_BUILD = 1; then
20if test $APPLE_UNIVERSAL_BUILD = 1; then 20 # A universal build on Apple Mac OS X platforms.
21 # A universal build on Apple MacOS X platforms. 21 # The test result would be 'yes' in 32-bit mode and 'no' in 64-bit mode.
22 # The test result would be 'yes' in 32-bit mode and 'no' in 64-bit mode. 22 # But we need a configuration result that is valid in both modes.
23 # But we need a configuration result that is valid in both modes. 23 gl_cv_func_working_mktime=no
24 ac_cv_func_working_mktime=no 24 fi
25fi 25 AC_CACHE_CHECK([for working mktime], [gl_cv_func_working_mktime],
26AC_CACHE_CHECK([for working mktime], [ac_cv_func_working_mktime], 26 [AC_RUN_IFELSE(
27[AC_RUN_IFELSE([AC_LANG_SOURCE( 27 [AC_LANG_SOURCE(
28[[/* Test program from Paul Eggert and Tony Leneis. */ 28[[/* Test program from Paul Eggert and Tony Leneis. */
29#include <limits.h> 29#include <limits.h>
30#include <stdlib.h> 30#include <stdlib.h>
@@ -34,8 +34,8 @@ AC_CACHE_CHECK([for working mktime], [ac_cv_func_working_mktime],
34# include <unistd.h> 34# include <unistd.h>
35#endif 35#endif
36 36
37#ifndef HAVE_ALARM 37#if HAVE_DECL_ALARM
38# define alarm(X) /* empty */ 38# include <signal.h>
39#endif 39#endif
40 40
41/* Work around redefinition to rpl_putenv by other config tests. */ 41/* Work around redefinition to rpl_putenv by other config tests. */
@@ -165,22 +165,29 @@ year_2050_test ()
165int 165int
166main () 166main ()
167{ 167{
168 int result = 0;
168 time_t t, delta; 169 time_t t, delta;
169 int i, j; 170 int i, j;
171 int time_t_signed_magnitude = (time_t) ~ (time_t) 0 < (time_t) -1;
172 int time_t_signed = ! ((time_t) 0 < (time_t) -1);
170 173
174#if HAVE_DECL_ALARM
171 /* This test makes some buggy mktime implementations loop. 175 /* This test makes some buggy mktime implementations loop.
172 Give up after 60 seconds; a mktime slower than that 176 Give up after 60 seconds; a mktime slower than that
173 isn't worth using anyway. */ 177 isn't worth using anyway. */
178 signal (SIGALRM, SIG_DFL);
174 alarm (60); 179 alarm (60);
180#endif
175 181
176 for (;;) 182 time_t_max = (! time_t_signed
177 { 183 ? (time_t) -1
178 t = (time_t_max << 1) + 1; 184 : ((((time_t) 1 << (sizeof (time_t) * CHAR_BIT - 2)) - 1)
179 if (t <= time_t_max) 185 * 2 + 1));
180 break; 186 time_t_min = (! time_t_signed
181 time_t_max = t; 187 ? (time_t) 0
182 } 188 : time_t_signed_magnitude
183 time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max; 189 ? ~ (time_t) 0
190 : ~ time_t_max);
184 191
185 delta = time_t_max / 997; /* a suitable prime number */ 192 delta = time_t_max / 997; /* a suitable prime number */
186 for (i = 0; i < N_STRINGS; i++) 193 for (i = 0; i < N_STRINGS; i++)
@@ -188,47 +195,59 @@ main ()
188 if (tz_strings[i]) 195 if (tz_strings[i])
189 putenv (tz_strings[i]); 196 putenv (tz_strings[i]);
190 197
191 for (t = 0; t <= time_t_max - delta; t += delta) 198 for (t = 0; t <= time_t_max - delta && (result & 1) == 0; t += delta)
192 if (! mktime_test (t)) 199 if (! mktime_test (t))
193 return 1; 200 result |= 1;
194 if (! (mktime_test ((time_t) 1) 201 if ((result & 2) == 0
195 && mktime_test ((time_t) (60 * 60)) 202 && ! (mktime_test ((time_t) 1)
196 && mktime_test ((time_t) (60 * 60 * 24)))) 203 && mktime_test ((time_t) (60 * 60))
197 return 1; 204 && mktime_test ((time_t) (60 * 60 * 24))))
198 205 result |= 2;
199 for (j = 1; ; j <<= 1) 206
200 if (! bigtime_test (j)) 207 for (j = 1; (result & 4) == 0; j <<= 1)
201 return 1; 208 {
202 else if (INT_MAX / 2 < j) 209 if (! bigtime_test (j))
203 break; 210 result |= 4;
204 if (! bigtime_test (INT_MAX)) 211 if (INT_MAX / 2 < j)
205 return 1; 212 break;
213 }
214 if ((result & 8) == 0 && ! bigtime_test (INT_MAX))
215 result |= 8;
206 } 216 }
207 return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ()); 217 if (! irix_6_4_bug ())
218 result |= 16;
219 if (! spring_forward_gap ())
220 result |= 32;
221 if (! year_2050_test ())
222 result |= 64;
223 return result;
208}]])], 224}]])],
209 [ac_cv_func_working_mktime=yes], 225 [gl_cv_func_working_mktime=yes],
210 [ac_cv_func_working_mktime=no], 226 [gl_cv_func_working_mktime=no],
211 [ac_cv_func_working_mktime=no])]) 227 [gl_cv_func_working_mktime=no])
212if test $ac_cv_func_working_mktime = no; then 228 ])
213 AC_LIBOBJ([mktime])
214fi
215])# AC_FUNC_MKTIME
216 229
217AC_DEFUN([gl_FUNC_MKTIME], 230 if test $gl_cv_func_working_mktime = no; then
218[
219 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
220 AC_FUNC_MKTIME
221 dnl Note: AC_FUNC_MKTIME does AC_LIBOBJ([mktime]).
222 if test $ac_cv_func_working_mktime = no; then
223 REPLACE_MKTIME=1 231 REPLACE_MKTIME=1
224 gl_PREREQ_MKTIME
225 else 232 else
226 REPLACE_MKTIME=0 233 REPLACE_MKTIME=0
227 fi 234 fi
228]) 235])
229 236
230# Prerequisites of lib/mktime.c. 237AC_DEFUN([gl_FUNC_MKTIME_INTERNAL], [
231AC_DEFUN([gl_PREREQ_MKTIME], 238 AC_REQUIRE([gl_FUNC_MKTIME])
232[ 239 if test $REPLACE_MKTIME = 0; then
233 AC_REQUIRE([AC_C_INLINE]) 240 dnl BeOS has __mktime_internal in libc, but other platforms don't.
241 AC_CHECK_FUNC([__mktime_internal],
242 [AC_DEFINE([mktime_internal], [__mktime_internal],
243 [Define to the real name of the mktime_internal function.])
244 ],
245 [dnl mktime works but it doesn't export __mktime_internal,
246 dnl so we need to substitute our own mktime implementation.
247 REPLACE_MKTIME=1
248 ])
249 fi
234]) 250])
251
252# Prerequisites of lib/mktime.c.
253AC_DEFUN([gl_PREREQ_MKTIME], [:])
diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4
index a6b7b9a..9b60ddf 100644
--- a/gl/m4/mmap-anon.m4
+++ b/gl/m4/mmap-anon.m4
@@ -1,5 +1,5 @@
1# mmap-anon.m4 serial 8 1# mmap-anon.m4 serial 10
2dnl Copyright (C) 2005, 2007, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2005, 2007, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -9,16 +9,12 @@ dnl with or without modifications, as long as this notice is preserved.
9# - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS 9# - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS
10# and MAP_ANON exist and have the same value. 10# and MAP_ANON exist and have the same value.
11# - On HP-UX, only MAP_ANONYMOUS exists. 11# - On HP-UX, only MAP_ANONYMOUS exists.
12# - On MacOS X, FreeBSD, NetBSD, OpenBSD, only MAP_ANON exists. 12# - On Mac OS X, FreeBSD, NetBSD, OpenBSD, only MAP_ANON exists.
13# - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be 13# - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be
14# used. 14# used.
15 15
16AC_DEFUN([gl_FUNC_MMAP_ANON], 16AC_DEFUN([gl_FUNC_MMAP_ANON],
17[ 17[
18 dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
19 AC_REQUIRE([AC_PROG_CPP])
20 AC_REQUIRE([AC_PROG_EGREP])
21
22 dnl Persuade glibc <sys/mman.h> to define MAP_ANONYMOUS. 18 dnl Persuade glibc <sys/mman.h> to define MAP_ANONYMOUS.
23 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 19 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
24 20
@@ -31,18 +27,18 @@ AC_DEFUN([gl_FUNC_MMAP_ANON],
31 gl_have_mmap_anonymous=no 27 gl_have_mmap_anonymous=no
32 if test $gl_have_mmap = yes; then 28 if test $gl_have_mmap = yes; then
33 AC_MSG_CHECKING([for MAP_ANONYMOUS]) 29 AC_MSG_CHECKING([for MAP_ANONYMOUS])
34 AC_EGREP_CPP([I cant identify this map.], [ 30 AC_EGREP_CPP([I cannot identify this map], [
35#include <sys/mman.h> 31#include <sys/mman.h>
36#ifdef MAP_ANONYMOUS 32#ifdef MAP_ANONYMOUS
37 I cant identify this map. 33 I cannot identify this map
38#endif 34#endif
39], 35],
40 [gl_have_mmap_anonymous=yes]) 36 [gl_have_mmap_anonymous=yes])
41 if test $gl_have_mmap_anonymous != yes; then 37 if test $gl_have_mmap_anonymous != yes; then
42 AC_EGREP_CPP([I cant identify this map.], [ 38 AC_EGREP_CPP([I cannot identify this map], [
43#include <sys/mman.h> 39#include <sys/mman.h>
44#ifdef MAP_ANON 40#ifdef MAP_ANON
45 I cant identify this map. 41 I cannot identify this map
46#endif 42#endif
47], 43],
48 [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON], 44 [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON],
diff --git a/gl/m4/mode_t.m4 b/gl/m4/mode_t.m4
deleted file mode 100644
index 3178dfd..0000000
--- a/gl/m4/mode_t.m4
+++ /dev/null
@@ -1,26 +0,0 @@
1# mode_t.m4 serial 2
2dnl Copyright (C) 2009-2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and
8# include <sys/types.h>.
9
10# Define PROMOTED_MODE_T to the type that is the result of "default argument
11# promotion" (ISO C 6.5.2.2.(6)) of the type mode_t.
12AC_DEFUN([gl_PROMOTED_TYPE_MODE_T],
13[
14 AC_REQUIRE([AC_TYPE_MODE_T])
15 AC_CACHE_CHECK([for promoted mode_t type], [gl_cv_promoted_mode_t], [
16 dnl Assume mode_t promotes to 'int' if and only if it is smaller than 'int',
17 dnl and to itself otherwise. This assumption is not guaranteed by the ISO C
18 dnl standard, but we don't know of any real-world counterexamples.
19 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]],
20 [[typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];]])],
21 [gl_cv_promoted_mode_t='int'],
22 [gl_cv_promoted_mode_t='mode_t'])
23 ])
24 AC_DEFINE_UNQUOTED([PROMOTED_MODE_T], [$gl_cv_promoted_mode_t],
25 [Define to the type that is the result of default argument promotions of type mode_t.])
26])
diff --git a/gl/m4/mountlist.m4 b/gl/m4/mountlist.m4
index f2d5950..cd137c9 100644
--- a/gl/m4/mountlist.m4
+++ b/gl/m4/mountlist.m4
@@ -1,5 +1,5 @@
1# serial 10 1# serial 11
2dnl Copyright (C) 2002-2006, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -8,10 +8,6 @@ AC_DEFUN([gl_MOUNTLIST],
8[ 8[
9 gl_LIST_MOUNTED_FILE_SYSTEMS([gl_cv_list_mounted_fs=yes], 9 gl_LIST_MOUNTED_FILE_SYSTEMS([gl_cv_list_mounted_fs=yes],
10 [gl_cv_list_mounted_fs=no]) 10 [gl_cv_list_mounted_fs=no])
11 if test $gl_cv_list_mounted_fs = yes; then
12 AC_LIBOBJ([mountlist])
13 gl_PREREQ_MOUNTLIST_EXTRA
14 fi
15]) 11])
16 12
17# Prerequisites of lib/mountlist.c not done by gl_LIST_MOUNTED_FILE_SYSTEMS. 13# Prerequisites of lib/mountlist.c not done by gl_LIST_MOUNTED_FILE_SYSTEMS.
diff --git a/gl/m4/msvc-inval.m4 b/gl/m4/msvc-inval.m4
new file mode 100644
index 0000000..9a6a47a
--- /dev/null
+++ b/gl/m4/msvc-inval.m4
@@ -0,0 +1,19 @@
1# msvc-inval.m4 serial 1
2dnl Copyright (C) 2011-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_MSVC_INVAL],
8[
9 AC_CHECK_FUNCS_ONCE([_set_invalid_parameter_handler])
10 if test $ac_cv_func__set_invalid_parameter_handler = yes; then
11 HAVE_MSVC_INVALID_PARAMETER_HANDLER=1
12 AC_DEFINE([HAVE_MSVC_INVALID_PARAMETER_HANDLER], [1],
13 [Define to 1 on MSVC platforms that have the "invalid parameter handler"
14 concept.])
15 else
16 HAVE_MSVC_INVALID_PARAMETER_HANDLER=0
17 fi
18 AC_SUBST([HAVE_MSVC_INVALID_PARAMETER_HANDLER])
19])
diff --git a/gl/m4/cloexec.m4 b/gl/m4/msvc-nothrow.m4
index c75595c..a39618a 100644
--- a/gl/m4/cloexec.m4
+++ b/gl/m4/msvc-nothrow.m4
@@ -1,10 +1,10 @@
1#serial 6 1# msvc-nothrow.m4 serial 1
2dnl Copyright (C) 2004-2006, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2011-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7AC_DEFUN([gl_CLOEXEC], 7AC_DEFUN([gl_MSVC_NOTHROW],
8[ 8[
9 AC_LIBOBJ([cloexec]) 9 AC_REQUIRE([gl_MSVC_INVAL])
10]) 10])
diff --git a/gl/m4/multiarch.m4 b/gl/m4/multiarch.m4
index 389bd2b..552ec7e 100644
--- a/gl/m4/multiarch.m4
+++ b/gl/m4/multiarch.m4
@@ -1,12 +1,12 @@
1# multiarch.m4 serial 5 1# multiarch.m4 serial 7
2dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7# Determine whether the compiler is or may be producing universal binaries. 7# Determine whether the compiler is or may be producing universal binaries.
8# 8#
9# On MacOS X 10.5 and later systems, the user can create libraries and 9# On Mac OS X 10.5 and later systems, the user can create libraries and
10# executables that work on multiple system types--known as "fat" or 10# executables that work on multiple system types--known as "fat" or
11# "universal" binaries--by specifying multiple '-arch' options to the 11# "universal" binaries--by specifying multiple '-arch' options to the
12# compiler but only a single '-arch' option to the preprocessor. Like 12# compiler but only a single '-arch' option to the preprocessor. Like
@@ -16,8 +16,7 @@ dnl with or without modifications, as long as this notice is preserved.
16# CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ 16# CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
17# CPP="gcc -E" CXXCPP="g++ -E" 17# CPP="gcc -E" CXXCPP="g++ -E"
18# 18#
19# Detect this situation and set the macro AA_APPLE_UNIVERSAL_BUILD at the 19# Detect this situation and set APPLE_UNIVERSAL_BUILD accordingly.
20# beginning of config.h and set APPLE_UNIVERSAL_BUILD accordingly.
21 20
22AC_DEFUN_ONCE([gl_MULTIARCH], 21AC_DEFUN_ONCE([gl_MULTIARCH],
23[ 22[
@@ -55,8 +54,6 @@ AC_DEFUN_ONCE([gl_MULTIARCH],
55 done 54 done
56 ]) 55 ])
57 if test $gl_cv_c_multiarch = yes; then 56 if test $gl_cv_c_multiarch = yes; then
58 AC_DEFINE([AA_APPLE_UNIVERSAL_BUILD], [1],
59 [Define if the compiler is building for multiple architectures of Apple platforms at once.])
60 APPLE_UNIVERSAL_BUILD=1 57 APPLE_UNIVERSAL_BUILD=1
61 else 58 else
62 APPLE_UNIVERSAL_BUILD=0 59 APPLE_UNIVERSAL_BUILD=0
diff --git a/gl/m4/netdb_h.m4 b/gl/m4/netdb_h.m4
index c870fb6..2c69f99 100644
--- a/gl/m4/netdb_h.m4
+++ b/gl/m4/netdb_h.m4
@@ -1,5 +1,5 @@
1# netdb_h.m4 serial 9 1# netdb_h.m4 serial 11
2dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -7,7 +7,6 @@ dnl with or without modifications, as long as this notice is preserved.
7AC_DEFUN([gl_HEADER_NETDB], 7AC_DEFUN([gl_HEADER_NETDB],
8[ 8[
9 AC_REQUIRE([gl_NETDB_H_DEFAULTS]) 9 AC_REQUIRE([gl_NETDB_H_DEFAULTS])
10 AC_CHECK_HEADERS_ONCE([netdb.h])
11 gl_CHECK_NEXT_HEADERS([netdb.h]) 10 gl_CHECK_NEXT_HEADERS([netdb.h])
12 if test $ac_cv_header_netdb_h = yes; then 11 if test $ac_cv_header_netdb_h = yes; then
13 HAVE_NETDB_H=1 12 HAVE_NETDB_H=1
@@ -27,6 +26,8 @@ AC_DEFUN([gl_NETDB_MODULE_INDICATOR],
27 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 26 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
28 AC_REQUIRE([gl_NETDB_H_DEFAULTS]) 27 AC_REQUIRE([gl_NETDB_H_DEFAULTS])
29 gl_MODULE_INDICATOR_SET_VARIABLE([$1]) 28 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
29 dnl Define it also as a C macro, for the benefit of the unit tests.
30 gl_MODULE_INDICATOR_FOR_TESTS([$1])
30]) 31])
31 32
32AC_DEFUN([gl_NETDB_H_DEFAULTS], 33AC_DEFUN([gl_NETDB_H_DEFAULTS],
@@ -38,4 +39,5 @@ AC_DEFUN([gl_NETDB_H_DEFAULTS],
38 HAVE_DECL_GAI_STRERROR=1; AC_SUBST([HAVE_DECL_GAI_STRERROR]) 39 HAVE_DECL_GAI_STRERROR=1; AC_SUBST([HAVE_DECL_GAI_STRERROR])
39 HAVE_DECL_GETADDRINFO=1; AC_SUBST([HAVE_DECL_GETADDRINFO]) 40 HAVE_DECL_GETADDRINFO=1; AC_SUBST([HAVE_DECL_GETADDRINFO])
40 HAVE_DECL_GETNAMEINFO=1; AC_SUBST([HAVE_DECL_GETNAMEINFO]) 41 HAVE_DECL_GETNAMEINFO=1; AC_SUBST([HAVE_DECL_GETNAMEINFO])
42 REPLACE_GAI_STRERROR=0; AC_SUBST([REPLACE_GAI_STRERROR])
41]) 43])
diff --git a/gl/m4/netinet_in_h.m4 b/gl/m4/netinet_in_h.m4
index cc7a44c..21971b2 100644
--- a/gl/m4/netinet_in_h.m4
+++ b/gl/m4/netinet_in_h.m4
@@ -1,5 +1,5 @@
1# netinet_in_h.m4 serial 4 1# netinet_in_h.m4 serial 5
2dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2006-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -27,4 +27,5 @@ AC_DEFUN([gl_HEADER_NETINET_IN],
27 AC_SUBST([HAVE_NETINET_IN_H]) 27 AC_SUBST([HAVE_NETINET_IN_H])
28 fi 28 fi
29 AC_SUBST([NETINET_IN_H]) 29 AC_SUBST([NETINET_IN_H])
30 AM_CONDITIONAL([GL_GENERATE_NETINET_IN_H], [test -n "$NETINET_IN_H"])
30]) 31])
diff --git a/gl/m4/nl_langinfo.m4 b/gl/m4/nl_langinfo.m4
index ad456a2..25e2101 100644
--- a/gl/m4/nl_langinfo.m4
+++ b/gl/m4/nl_langinfo.m4
@@ -1,5 +1,5 @@
1# nl_langinfo.m4 serial 3 1# nl_langinfo.m4 serial 5
2dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -9,17 +9,42 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO],
9 AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) 9 AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
10 AC_REQUIRE([gl_LANGINFO_H]) 10 AC_REQUIRE([gl_LANGINFO_H])
11 AC_CHECK_FUNCS_ONCE([nl_langinfo]) 11 AC_CHECK_FUNCS_ONCE([nl_langinfo])
12 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
12 if test $ac_cv_func_nl_langinfo = yes; then 13 if test $ac_cv_func_nl_langinfo = yes; then
13 if test $HAVE_LANGINFO_CODESET = 1 && test $HAVE_LANGINFO_ERA = 1; then 14 # On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken.
15 AC_CACHE_CHECK([whether YESEXPR works],
16 [gl_cv_func_nl_langinfo_yesexpr_works],
17 [AC_RUN_IFELSE(
18 [AC_LANG_PROGRAM([[#include <langinfo.h>
19]], [[return !*nl_langinfo(YESEXPR);
20]])],
21 [gl_cv_func_nl_langinfo_yesexpr_works=yes],
22 [gl_cv_func_nl_langinfo_yesexpr_works=no],
23 [
24 case "$host_os" in
25 # Guess no on irix systems.
26 irix*) gl_cv_func_nl_langinfo_yesexpr_works="guessing no";;
27 # Guess yes elsewhere.
28 *) gl_cv_func_nl_langinfo_yesexpr_works="guessing yes";;
29 esac
30 ])
31 ])
32 case $gl_cv_func_nl_langinfo_yesexpr_works in
33 *yes) FUNC_NL_LANGINFO_YESEXPR_WORKS=1 ;;
34 *) FUNC_NL_LANGINFO_YESEXPR_WORKS=0 ;;
35 esac
36 AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS],
37 [$FUNC_NL_LANGINFO_YESEXPR_WORKS],
38 [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.])
39 if test $HAVE_LANGINFO_CODESET = 1 && test $HAVE_LANGINFO_ERA = 1 \
40 && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1; then
14 : 41 :
15 else 42 else
16 REPLACE_NL_LANGINFO=1 43 REPLACE_NL_LANGINFO=1
17 AC_DEFINE([REPLACE_NL_LANGINFO], [1], 44 AC_DEFINE([REPLACE_NL_LANGINFO], [1],
18 [Define if nl_langinfo exists but is overridden by gnulib.]) 45 [Define if nl_langinfo exists but is overridden by gnulib.])
19 AC_LIBOBJ([nl_langinfo])
20 fi 46 fi
21 else 47 else
22 HAVE_NL_LANGINFO=0 48 HAVE_NL_LANGINFO=0
23 AC_LIBOBJ([nl_langinfo])
24 fi 49 fi
25]) 50])
diff --git a/gl/m4/nls.m4 b/gl/m4/nls.m4
index 003704c..8f8a147 100644
--- a/gl/m4/nls.m4
+++ b/gl/m4/nls.m4
@@ -1,5 +1,5 @@
1# nls.m4 serial 5 (gettext-0.18) 1# nls.m4 serial 5 (gettext-0.18)
2dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation, 2dnl Copyright (C) 1995-2003, 2005-2006, 2008-2013 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
diff --git a/gl/m4/nocrash.m4 b/gl/m4/nocrash.m4
new file mode 100644
index 0000000..105b884
--- /dev/null
+++ b/gl/m4/nocrash.m4
@@ -0,0 +1,130 @@
1# nocrash.m4 serial 4
2dnl Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl Based on libsigsegv, from Bruno Haible and Paolo Bonzini.
8
9AC_PREREQ([2.13])
10
11dnl Expands to some code for use in .c programs that will cause the configure
12dnl test to exit instead of crashing. This is useful to avoid triggering
13dnl action from a background debugger and to avoid core dumps.
14dnl Usage: ...
15dnl ]GL_NOCRASH[
16dnl ...
17dnl int main() { nocrash_init(); ... }
18AC_DEFUN([GL_NOCRASH],[[
19#include <stdlib.h>
20#if defined __MACH__ && defined __APPLE__
21/* Avoid a crash on Mac OS X. */
22#include <mach/mach.h>
23#include <mach/mach_error.h>
24#include <mach/thread_status.h>
25#include <mach/exception.h>
26#include <mach/task.h>
27#include <pthread.h>
28/* The exception port on which our thread listens. */
29static mach_port_t our_exception_port;
30/* The main function of the thread listening for exceptions of type
31 EXC_BAD_ACCESS. */
32static void *
33mach_exception_thread (void *arg)
34{
35 /* Buffer for a message to be received. */
36 struct {
37 mach_msg_header_t head;
38 mach_msg_body_t msgh_body;
39 char data[1024];
40 } msg;
41 mach_msg_return_t retval;
42 /* Wait for a message on the exception port. */
43 retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg),
44 our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
45 if (retval != MACH_MSG_SUCCESS)
46 abort ();
47 exit (1);
48}
49static void
50nocrash_init (void)
51{
52 mach_port_t self = mach_task_self ();
53 /* Allocate a port on which the thread shall listen for exceptions. */
54 if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port)
55 == KERN_SUCCESS) {
56 /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */
57 if (mach_port_insert_right (self, our_exception_port, our_exception_port,
58 MACH_MSG_TYPE_MAKE_SEND)
59 == KERN_SUCCESS) {
60 /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting
61 for us. */
62 exception_mask_t mask = EXC_MASK_BAD_ACCESS;
63 /* Create the thread listening on the exception port. */
64 pthread_attr_t attr;
65 pthread_t thread;
66 if (pthread_attr_init (&attr) == 0
67 && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0
68 && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) {
69 pthread_attr_destroy (&attr);
70 /* Replace the exception port info for these exceptions with our own.
71 Note that we replace the exception port for the entire task, not only
72 for a particular thread. This has the effect that when our exception
73 port gets the message, the thread specific exception port has already
74 been asked, and we don't need to bother about it.
75 See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */
76 task_set_exception_ports (self, mask, our_exception_port,
77 EXCEPTION_DEFAULT, MACHINE_THREAD_STATE);
78 }
79 }
80 }
81}
82#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
83/* Avoid a crash on native Windows. */
84#define WIN32_LEAN_AND_MEAN
85#include <windows.h>
86#include <winerror.h>
87static LONG WINAPI
88exception_filter (EXCEPTION_POINTERS *ExceptionInfo)
89{
90 switch (ExceptionInfo->ExceptionRecord->ExceptionCode)
91 {
92 case EXCEPTION_ACCESS_VIOLATION:
93 case EXCEPTION_IN_PAGE_ERROR:
94 case EXCEPTION_STACK_OVERFLOW:
95 case EXCEPTION_GUARD_PAGE:
96 case EXCEPTION_PRIV_INSTRUCTION:
97 case EXCEPTION_ILLEGAL_INSTRUCTION:
98 case EXCEPTION_DATATYPE_MISALIGNMENT:
99 case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
100 case EXCEPTION_NONCONTINUABLE_EXCEPTION:
101 exit (1);
102 }
103 return EXCEPTION_CONTINUE_SEARCH;
104}
105static void
106nocrash_init (void)
107{
108 SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter);
109}
110#else
111/* Avoid a crash on POSIX systems. */
112#include <signal.h>
113/* A POSIX signal handler. */
114static void
115exception_handler (int sig)
116{
117 exit (1);
118}
119static void
120nocrash_init (void)
121{
122#ifdef SIGSEGV
123 signal (SIGSEGV, exception_handler);
124#endif
125#ifdef SIGBUS
126 signal (SIGBUS, exception_handler);
127#endif
128}
129#endif
130]])
diff --git a/gl/m4/off_t.m4 b/gl/m4/off_t.m4
new file mode 100644
index 0000000..d355d01
--- /dev/null
+++ b/gl/m4/off_t.m4
@@ -0,0 +1,18 @@
1# off_t.m4 serial 1
2dnl Copyright (C) 2012-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl Check whether to override the 'off_t' type.
8dnl Set WINDOWS_64_BIT_OFF_T.
9
10AC_DEFUN([gl_TYPE_OFF_T],
11[
12 m4_ifdef([gl_LARGEFILE], [
13 AC_REQUIRE([gl_LARGEFILE])
14 ], [
15 WINDOWS_64_BIT_OFF_T=0
16 ])
17 AC_SUBST([WINDOWS_64_BIT_OFF_T])
18])
diff --git a/gl/m4/onceonly.m4 b/gl/m4/onceonly.m4
index 6a9c87b..0a875a3 100644
--- a/gl/m4/onceonly.m4
+++ b/gl/m4/onceonly.m4
@@ -1,9 +1,22 @@
1# onceonly.m4 serial 7 1# onceonly.m4 serial 9
2dnl Copyright (C) 2002-2003, 2005-2006, 2008-2010 Free Software Foundation, 2dnl Copyright (C) 2002-2003, 2005-2006, 2008-2013 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software, distributed under the terms of the GNU 4dnl
5dnl General Public License. As a special exception to the GNU General 5dnl This file is free software; you can redistribute it and/or modify
6dnl Public License, this file may be distributed as part of a program 6dnl it under the terms of the GNU General Public License as published by
7dnl the Free Software Foundation; either version 3 of the License, or
8dnl (at your option) any later version.
9dnl
10dnl This file is distributed in the hope that it will be useful,
11dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13dnl GNU General Public License for more details.
14dnl
15dnl You should have received a copy of the GNU General Public License
16dnl along with this file. If not, see <http://www.gnu.org/licenses/>.
17dnl
18dnl As a special exception to the GNU General Public License,
19dnl this file may be distributed as part of a program
7dnl that contains a configuration script generated by Autoconf, under 20dnl that contains a configuration script generated by Autoconf, under
8dnl the same distribution terms as the rest of that program. 21dnl the same distribution terms as the rest of that program.
9 22
@@ -67,7 +80,7 @@ AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
67 [gl_func_list="$gl_func_list gl_FUNC_NAME"]) 80 [gl_func_list="$gl_func_list gl_FUNC_NAME"])
68 gl_FUNCS_EXPANSION 81 gl_FUNCS_EXPANSION
69 AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])), 82 AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])),
70 [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.]) 83 [Define to 1 if you have the ']m4_defn([gl_FUNC_NAME])[' function.])
71 ]) 84 ])
72 AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME])) 85 AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
73 ]) 86 ])
diff --git a/gl/m4/open.m4 b/gl/m4/open.m4
deleted file mode 100644
index d705b3a..0000000
--- a/gl/m4/open.m4
+++ /dev/null
@@ -1,74 +0,0 @@
1# open.m4 serial 8
2dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_OPEN],
8[
9 AC_REQUIRE([AC_CANONICAL_HOST])
10 case "$host_os" in
11 mingw* | pw*)
12 gl_REPLACE_OPEN
13 ;;
14 *)
15 dnl open("foo/") should not create a file when the file name has a
16 dnl trailing slash. FreeBSD only has the problem on symlinks.
17 AC_CHECK_FUNCS_ONCE([lstat])
18 AC_CACHE_CHECK([whether open recognizes a trailing slash],
19 [gl_cv_func_open_slash],
20 [# Assume that if we have lstat, we can also check symlinks.
21 if test $ac_cv_func_lstat = yes; then
22 touch conftest.tmp
23 ln -s conftest.tmp conftest.lnk
24 fi
25 AC_TRY_RUN([
26#include <fcntl.h>
27#if HAVE_UNISTD_H
28# include <unistd.h>
29#endif
30int main ()
31{
32#if HAVE_LSTAT
33 if (open ("conftest.lnk/", O_RDONLY) != -1) return 2;
34#endif
35 return open ("conftest.sl/", O_CREAT, 0600) >= 0;
36}], [gl_cv_func_open_slash=yes], [gl_cv_func_open_slash=no],
37 [
38changequote(,)dnl
39 case "$host_os" in
40 freebsd*) gl_cv_func_open_slash="guessing no" ;;
41 solaris2.[0-9]*) gl_cv_func_open_slash="guessing no" ;;
42 hpux*) gl_cv_func_open_slash="guessing no" ;;
43 *) gl_cv_func_open_slash="guessing yes" ;;
44 esac
45changequote([,])dnl
46 ])
47 rm -f conftest.sl conftest.tmp conftest.lnk
48 ])
49 case "$gl_cv_func_open_slash" in
50 *no)
51 AC_DEFINE([OPEN_TRAILING_SLASH_BUG], [1],
52 [Define to 1 if open() fails to recognize a trailing slash.])
53 gl_REPLACE_OPEN
54 ;;
55 esac
56 ;;
57 esac
58])
59
60AC_DEFUN([gl_REPLACE_OPEN],
61[
62 AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
63 REPLACE_OPEN=1
64 AC_LIBOBJ([open])
65 gl_PREREQ_OPEN
66])
67
68# Prerequisites of lib/open.c.
69AC_DEFUN([gl_PREREQ_OPEN],
70[
71 AC_REQUIRE([AC_C_INLINE])
72 AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])
73 :
74])
diff --git a/gl/m4/po.m4 b/gl/m4/po.m4
index 47f36a4..1c70b6c 100644
--- a/gl/m4/po.m4
+++ b/gl/m4/po.m4
@@ -1,5 +1,5 @@
1# po.m4 serial 17 (gettext-0.18) 1# po.m4 serial 21 (gettext-0.18.3)
2dnl Copyright (C) 1995-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 1995-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -17,14 +17,15 @@ dnl Authors:
17dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. 17dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. 18dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
19 19
20AC_PREREQ([2.50]) 20AC_PREREQ([2.60])
21 21
22dnl Checks for all prerequisites of the po subdirectory. 22dnl Checks for all prerequisites of the po subdirectory.
23AC_DEFUN([AM_PO_SUBDIRS], 23AC_DEFUN([AM_PO_SUBDIRS],
24[ 24[
25 AC_REQUIRE([AC_PROG_MAKE_SET])dnl 25 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
26 AC_REQUIRE([AC_PROG_INSTALL])dnl 26 AC_REQUIRE([AC_PROG_INSTALL])dnl
27 AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake 27 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
28 AC_REQUIRE([AC_PROG_SED])dnl
28 AC_REQUIRE([AM_NLS])dnl 29 AC_REQUIRE([AM_NLS])dnl
29 30
30 dnl Release version of the gettext macros. This is used to ensure that 31 dnl Release version of the gettext macros. This is used to ensure that
@@ -102,7 +103,7 @@ changequote([,])dnl
102 case "$ac_file" in */Makefile.in) 103 case "$ac_file" in */Makefile.in)
103 # Adjust a relative srcdir. 104 # Adjust a relative srcdir.
104 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` 105 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
105 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" 106 ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
106 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` 107 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
107 # In autoconf-2.13 it is called $ac_given_srcdir. 108 # In autoconf-2.13 it is called $ac_given_srcdir.
108 # In autoconf-2.50 it is called $srcdir. 109 # In autoconf-2.50 it is called $srcdir.
@@ -118,7 +119,8 @@ changequote([,])dnl
118 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then 119 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
119 rm -f "$ac_dir/POTFILES" 120 rm -f "$ac_dir/POTFILES"
120 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" 121 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
121 cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" 122 gt_tab=`printf '\t'`
123 cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
122 POMAKEFILEDEPS="POTFILES.in" 124 POMAKEFILEDEPS="POTFILES.in"
123 # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend 125 # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
124 # on $ac_dir but don't depend on user-specified configuration 126 # on $ac_dir but don't depend on user-specified configuration
@@ -129,12 +131,12 @@ changequote([,])dnl
129 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" 131 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
130 fi 132 fi
131 ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` 133 ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
132 # Hide the ALL_LINGUAS assigment from automake < 1.5. 134 # Hide the ALL_LINGUAS assignment from automake < 1.5.
133 eval 'ALL_LINGUAS''=$ALL_LINGUAS_' 135 eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
134 POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" 136 POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
135 else 137 else
136 # The set of available languages was given in configure.in. 138 # The set of available languages was given in configure.in.
137 # Hide the ALL_LINGUAS assigment from automake < 1.5. 139 # Hide the ALL_LINGUAS assignment from automake < 1.5.
138 eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' 140 eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
139 fi 141 fi
140 # Compute POFILES 142 # Compute POFILES
@@ -226,7 +228,7 @@ AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
226changequote(,)dnl 228changequote(,)dnl
227 # Adjust a relative srcdir. 229 # Adjust a relative srcdir.
228 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` 230 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
229 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" 231 ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
230 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` 232 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
231 # In autoconf-2.13 it is called $ac_given_srcdir. 233 # In autoconf-2.13 it is called $ac_given_srcdir.
232 # In autoconf-2.50 it is called $srcdir. 234 # In autoconf-2.50 it is called $srcdir.
@@ -254,6 +256,7 @@ EOT
254 fi 256 fi
255 257
256 # A sed script that extracts the value of VARIABLE from a Makefile. 258 # A sed script that extracts the value of VARIABLE from a Makefile.
259 tab=`printf '\t'`
257 sed_x_variable=' 260 sed_x_variable='
258# Test if the hold space is empty. 261# Test if the hold space is empty.
259x 262x
@@ -261,9 +264,9 @@ s/P/P/
261x 264x
262ta 265ta
263# Yes it was empty. Look if we have the expected variable definition. 266# Yes it was empty. Look if we have the expected variable definition.
264/^[ ]*VARIABLE[ ]*=/{ 267/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=/{
265 # Seen the first line of the variable definition. 268 # Seen the first line of the variable definition.
266 s/^[ ]*VARIABLE[ ]*=// 269 s/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=//
267 ba 270 ba
268} 271}
269bd 272bd
@@ -315,7 +318,7 @@ changequote([,])dnl
315 sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'` 318 sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`
316 ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"` 319 ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
317 fi 320 fi
318 # Hide the ALL_LINGUAS assigment from automake < 1.5. 321 # Hide the ALL_LINGUAS assignment from automake < 1.5.
319 eval 'ALL_LINGUAS''=$ALL_LINGUAS_' 322 eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
320 # Compute POFILES 323 # Compute POFILES
321 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) 324 # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
@@ -405,14 +408,15 @@ changequote([,])dnl
405 fi 408 fi
406 409
407 sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp" 410 sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
411 tab=`printf '\t'`
408 if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then 412 if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
409 # Add dependencies that cannot be formulated as a simple suffix rule. 413 # Add dependencies that cannot be formulated as a simple suffix rule.
410 for lang in $ALL_LINGUAS; do 414 for lang in $ALL_LINGUAS; do
411 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` 415 frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
412 cat >> "$ac_file.tmp" <<EOF 416 cat >> "$ac_file.tmp" <<EOF
413$frobbedlang.msg: $lang.po 417$frobbedlang.msg: $lang.po
414 @echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \ 418${tab}@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
415 \$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; } 419${tab}\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
416EOF 420EOF
417 done 421 done
418 fi 422 fi
@@ -422,8 +426,8 @@ EOF
422 frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` 426 frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
423 cat >> "$ac_file.tmp" <<EOF 427 cat >> "$ac_file.tmp" <<EOF
424$frobbedlang/\$(DOMAIN).resources.dll: $lang.po 428$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
425 @echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \ 429${tab}@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
426 \$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; } 430${tab}\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
427EOF 431EOF
428 done 432 done
429 fi 433 fi
diff --git a/gl/m4/printf-posix.m4 b/gl/m4/printf-posix.m4
index 1eacf95..d7dfb60 100644
--- a/gl/m4/printf-posix.m4
+++ b/gl/m4/printf-posix.m4
@@ -1,5 +1,5 @@
1# printf-posix.m4 serial 5 (gettext-0.18) 1# printf-posix.m4 serial 6 (gettext-0.18.2)
2dnl Copyright (C) 2003, 2007, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -14,7 +14,8 @@ AC_DEFUN([gt_PRINTF_POSIX],
14 AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings], 14 AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings],
15 gt_cv_func_printf_posix, 15 gt_cv_func_printf_posix,
16 [ 16 [
17 AC_TRY_RUN([ 17 AC_RUN_IFELSE(
18 [AC_LANG_SOURCE([[
18#include <stdio.h> 19#include <stdio.h>
19#include <string.h> 20#include <string.h>
20/* The string "%2$d %1$d", with dollar characters protected from the shell's 21/* The string "%2$d %1$d", with dollar characters protected from the shell's
@@ -25,16 +26,18 @@ int main ()
25{ 26{
26 sprintf (buf, format, 33, 55); 27 sprintf (buf, format, 33, 55);
27 return (strcmp (buf, "55 33") != 0); 28 return (strcmp (buf, "55 33") != 0);
28}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no, 29}]])],
29 [ 30 [gt_cv_func_printf_posix=yes],
30 AC_EGREP_CPP([notposix], [ 31 [gt_cv_func_printf_posix=no],
32 [
33 AC_EGREP_CPP([notposix], [
31#if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ 34#if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
32 notposix 35 notposix
33#endif 36#endif
34 ], 37 ],
35 [gt_cv_func_printf_posix="guessing no"], 38 [gt_cv_func_printf_posix="guessing no"],
36 [gt_cv_func_printf_posix="guessing yes"]) 39 [gt_cv_func_printf_posix="guessing yes"])
37 ]) 40 ])
38 ]) 41 ])
39 case $gt_cv_func_printf_posix in 42 case $gt_cv_func_printf_posix in
40 *yes) 43 *yes)
diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4
index b31efe3..ef44f78 100644
--- a/gl/m4/printf.m4
+++ b/gl/m4/printf.m4
@@ -1,5 +1,5 @@
1# printf.m4 serial 34 1# printf.m4 serial 50
2dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -17,7 +17,8 @@ AC_DEFUN([gl_PRINTF_SIZES_C99],
17 AC_CACHE_CHECK([whether printf supports size specifiers as in C99], 17 AC_CACHE_CHECK([whether printf supports size specifiers as in C99],
18 [gl_cv_func_printf_sizes_c99], 18 [gl_cv_func_printf_sizes_c99],
19 [ 19 [
20 AC_TRY_RUN([ 20 AC_RUN_IFELSE(
21 [AC_LANG_SOURCE([[
21#include <stddef.h> 22#include <stddef.h>
22#include <stdio.h> 23#include <stdio.h>
23#include <string.h> 24#include <string.h>
@@ -31,53 +32,56 @@ AC_DEFUN([gl_PRINTF_SIZES_C99],
31static char buf[100]; 32static char buf[100];
32int main () 33int main ()
33{ 34{
35 int result = 0;
34#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX 36#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX
35 buf[0] = '\0'; 37 buf[0] = '\0';
36 if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 38 if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0
37 || strcmp (buf, "12345671 33") != 0) 39 || strcmp (buf, "12345671 33") != 0)
38 return 1; 40 result |= 1;
39#endif 41#endif
40 buf[0] = '\0'; 42 buf[0] = '\0';
41 if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 43 if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0
42 || strcmp (buf, "12345672 33") != 0) 44 || strcmp (buf, "12345672 33") != 0)
43 return 1; 45 result |= 2;
44 buf[0] = '\0'; 46 buf[0] = '\0';
45 if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0 47 if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0
46 || strcmp (buf, "12345673 33") != 0) 48 || strcmp (buf, "12345673 33") != 0)
47 return 1; 49 result |= 4;
48 buf[0] = '\0'; 50 buf[0] = '\0';
49 if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0 51 if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0
50 || strcmp (buf, "1.5 33") != 0) 52 || strcmp (buf, "1.5 33") != 0)
51 return 1; 53 result |= 8;
52 return 0; 54 return result;
53}], [gl_cv_func_printf_sizes_c99=yes], [gl_cv_func_printf_sizes_c99=no], 55}]])],
54 [ 56 [gl_cv_func_printf_sizes_c99=yes],
57 [gl_cv_func_printf_sizes_c99=no],
58 [
55changequote(,)dnl 59changequote(,)dnl
56 case "$host_os" in 60 case "$host_os" in
57 # Guess yes on glibc systems. 61 # Guess yes on glibc systems.
58 *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; 62 *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";;
59 # Guess yes on FreeBSD >= 5. 63 # Guess yes on FreeBSD >= 5.
60 freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";; 64 freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";;
61 freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; 65 freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
62 # Guess yes on MacOS X >= 10.3. 66 # Guess yes on Mac OS X >= 10.3.
63 darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; 67 darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";;
64 darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; 68 darwin*) gl_cv_func_printf_sizes_c99="guessing yes";;
65 # Guess yes on OpenBSD >= 3.9. 69 # Guess yes on OpenBSD >= 3.9.
66 openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) 70 openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
67 gl_cv_func_printf_sizes_c99="guessing no";; 71 gl_cv_func_printf_sizes_c99="guessing no";;
68 openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; 72 openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
69 # Guess yes on Solaris >= 2.10. 73 # Guess yes on Solaris >= 2.10.
70 solaris2.[0-9]*) gl_cv_func_printf_sizes_c99="guessing no";; 74 solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";;
71 solaris*) gl_cv_func_printf_sizes_c99="guessing yes";; 75 solaris*) gl_cv_func_printf_sizes_c99="guessing no";;
72 # Guess yes on NetBSD >= 3. 76 # Guess yes on NetBSD >= 3.
73 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) 77 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
74 gl_cv_func_printf_sizes_c99="guessing no";; 78 gl_cv_func_printf_sizes_c99="guessing no";;
75 netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; 79 netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
76 # If we don't know, assume the worst. 80 # If we don't know, assume the worst.
77 *) gl_cv_func_printf_sizes_c99="guessing no";; 81 *) gl_cv_func_printf_sizes_c99="guessing no";;
78 esac 82 esac
79changequote([,])dnl 83changequote([,])dnl
80 ]) 84 ])
81 ]) 85 ])
82]) 86])
83 87
@@ -92,35 +96,39 @@ AC_DEFUN([gl_PRINTF_LONG_DOUBLE],
92 AC_CACHE_CHECK([whether printf supports 'long double' arguments], 96 AC_CACHE_CHECK([whether printf supports 'long double' arguments],
93 [gl_cv_func_printf_long_double], 97 [gl_cv_func_printf_long_double],
94 [ 98 [
95 AC_TRY_RUN([ 99 AC_RUN_IFELSE(
100 [AC_LANG_SOURCE([[
96#include <stdio.h> 101#include <stdio.h>
97#include <string.h> 102#include <string.h>
98static char buf[10000]; 103static char buf[10000];
99int main () 104int main ()
100{ 105{
106 int result = 0;
101 buf[0] = '\0'; 107 buf[0] = '\0';
102 if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 108 if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0
103 || strcmp (buf, "1.750000 33") != 0) 109 || strcmp (buf, "1.750000 33") != 0)
104 return 1; 110 result |= 1;
105 buf[0] = '\0'; 111 buf[0] = '\0';
106 if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 112 if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0
107 || strcmp (buf, "1.750000e+00 33") != 0) 113 || strcmp (buf, "1.750000e+00 33") != 0)
108 return 1; 114 result |= 2;
109 buf[0] = '\0'; 115 buf[0] = '\0';
110 if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 116 if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0
111 || strcmp (buf, "1.75 33") != 0) 117 || strcmp (buf, "1.75 33") != 0)
112 return 1; 118 result |= 4;
113 return 0; 119 return result;
114}], [gl_cv_func_printf_long_double=yes], [gl_cv_func_printf_long_double=no], 120}]])],
115 [ 121 [gl_cv_func_printf_long_double=yes],
122 [gl_cv_func_printf_long_double=no],
123 [
116changequote(,)dnl 124changequote(,)dnl
117 case "$host_os" in 125 case "$host_os" in
118 beos*) gl_cv_func_printf_long_double="guessing no";; 126 beos*) gl_cv_func_printf_long_double="guessing no";;
119 mingw* | pw*) gl_cv_func_printf_long_double="guessing no";; 127 mingw* | pw*) gl_cv_func_printf_long_double="guessing no";;
120 *) gl_cv_func_printf_long_double="guessing yes";; 128 *) gl_cv_func_printf_long_double="guessing yes";;
121 esac 129 esac
122changequote([,])dnl 130changequote([,])dnl
123 ]) 131 ])
124 ]) 132 ])
125]) 133])
126 134
@@ -136,7 +144,8 @@ AC_DEFUN([gl_PRINTF_INFINITE],
136 AC_CACHE_CHECK([whether printf supports infinite 'double' arguments], 144 AC_CACHE_CHECK([whether printf supports infinite 'double' arguments],
137 [gl_cv_func_printf_infinite], 145 [gl_cv_func_printf_infinite],
138 [ 146 [
139 AC_TRY_RUN([ 147 AC_RUN_IFELSE(
148 [AC_LANG_SOURCE([[
140#include <stdio.h> 149#include <stdio.h>
141#include <string.h> 150#include <string.h>
142static int 151static int
@@ -168,65 +177,68 @@ static char buf[10000];
168static double zero = 0.0; 177static double zero = 0.0;
169int main () 178int main ()
170{ 179{
171 if (sprintf (buf, "%f", 1.0 / 0.0) < 0 180 int result = 0;
181 if (sprintf (buf, "%f", 1.0 / zero) < 0
172 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) 182 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
173 return 1; 183 result |= 1;
174 if (sprintf (buf, "%f", -1.0 / 0.0) < 0 184 if (sprintf (buf, "%f", -1.0 / zero) < 0
175 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) 185 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
176 return 1; 186 result |= 1;
177 if (sprintf (buf, "%f", zero / zero) < 0 187 if (sprintf (buf, "%f", zero / zero) < 0
178 || !strisnan (buf, 0, strlen (buf))) 188 || !strisnan (buf, 0, strlen (buf)))
179 return 1; 189 result |= 2;
180 if (sprintf (buf, "%e", 1.0 / 0.0) < 0 190 if (sprintf (buf, "%e", 1.0 / zero) < 0
181 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) 191 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
182 return 1; 192 result |= 4;
183 if (sprintf (buf, "%e", -1.0 / 0.0) < 0 193 if (sprintf (buf, "%e", -1.0 / zero) < 0
184 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) 194 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
185 return 1; 195 result |= 4;
186 if (sprintf (buf, "%e", zero / zero) < 0 196 if (sprintf (buf, "%e", zero / zero) < 0
187 || !strisnan (buf, 0, strlen (buf))) 197 || !strisnan (buf, 0, strlen (buf)))
188 return 1; 198 result |= 8;
189 if (sprintf (buf, "%g", 1.0 / 0.0) < 0 199 if (sprintf (buf, "%g", 1.0 / zero) < 0
190 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) 200 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
191 return 1; 201 result |= 16;
192 if (sprintf (buf, "%g", -1.0 / 0.0) < 0 202 if (sprintf (buf, "%g", -1.0 / zero) < 0
193 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) 203 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
194 return 1; 204 result |= 16;
195 if (sprintf (buf, "%g", zero / zero) < 0 205 if (sprintf (buf, "%g", zero / zero) < 0
196 || !strisnan (buf, 0, strlen (buf))) 206 || !strisnan (buf, 0, strlen (buf)))
197 return 1; 207 result |= 32;
198 /* This test fails on HP-UX 10.20. */ 208 /* This test fails on HP-UX 10.20. */
199 if (have_minus_zero ()) 209 if (have_minus_zero ())
200 if (sprintf (buf, "%g", - zero) < 0 210 if (sprintf (buf, "%g", - zero) < 0
201 || strcmp (buf, "-0") != 0) 211 || strcmp (buf, "-0") != 0)
202 return 1; 212 result |= 64;
203 return 0; 213 return result;
204}], [gl_cv_func_printf_infinite=yes], [gl_cv_func_printf_infinite=no], 214}]])],
205 [ 215 [gl_cv_func_printf_infinite=yes],
216 [gl_cv_func_printf_infinite=no],
217 [
206changequote(,)dnl 218changequote(,)dnl
207 case "$host_os" in 219 case "$host_os" in
208 # Guess yes on glibc systems. 220 # Guess yes on glibc systems.
209 *-gnu*) gl_cv_func_printf_infinite="guessing yes";; 221 *-gnu*) gl_cv_func_printf_infinite="guessing yes";;
210 # Guess yes on FreeBSD >= 6. 222 # Guess yes on FreeBSD >= 6.
211 freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";; 223 freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";;
212 freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; 224 freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";;
213 # Guess yes on MacOS X >= 10.3. 225 # Guess yes on Mac OS X >= 10.3.
214 darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; 226 darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";;
215 darwin*) gl_cv_func_printf_infinite="guessing yes";; 227 darwin*) gl_cv_func_printf_infinite="guessing yes";;
216 # Guess yes on HP-UX >= 11. 228 # Guess yes on HP-UX >= 11.
217 hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";; 229 hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";;
218 hpux*) gl_cv_func_printf_infinite="guessing yes";; 230 hpux*) gl_cv_func_printf_infinite="guessing yes";;
219 # Guess yes on NetBSD >= 3. 231 # Guess yes on NetBSD >= 3.
220 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) 232 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
221 gl_cv_func_printf_infinite="guessing no";; 233 gl_cv_func_printf_infinite="guessing no";;
222 netbsd*) gl_cv_func_printf_infinite="guessing yes";; 234 netbsd*) gl_cv_func_printf_infinite="guessing yes";;
223 # Guess yes on BeOS. 235 # Guess yes on BeOS.
224 beos*) gl_cv_func_printf_infinite="guessing yes";; 236 beos*) gl_cv_func_printf_infinite="guessing yes";;
225 # If we don't know, assume the worst. 237 # If we don't know, assume the worst.
226 *) gl_cv_func_printf_infinite="guessing no";; 238 *) gl_cv_func_printf_infinite="guessing no";;
227 esac 239 esac
228changequote([,])dnl 240changequote([,])dnl
229 ]) 241 ])
230 ]) 242 ])
231]) 243])
232 244
@@ -239,6 +251,7 @@ AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE],
239 AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) 251 AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
240 AC_REQUIRE([AC_PROG_CC]) 252 AC_REQUIRE([AC_PROG_CC])
241 AC_REQUIRE([gl_BIGENDIAN]) 253 AC_REQUIRE([gl_BIGENDIAN])
254 AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
242 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 255 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
243 dnl The user can set or unset the variable gl_printf_safe to indicate 256 dnl The user can set or unset the variable gl_printf_safe to indicate
244 dnl that he wishes a safe handling of non-IEEE-754 'long double' values. 257 dnl that he wishes a safe handling of non-IEEE-754 'long double' values.
@@ -252,7 +265,8 @@ AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE],
252 AC_CACHE_CHECK([whether printf supports infinite 'long double' arguments], 265 AC_CACHE_CHECK([whether printf supports infinite 'long double' arguments],
253 [gl_cv_func_printf_infinite_long_double], 266 [gl_cv_func_printf_infinite_long_double],
254 [ 267 [
255 AC_TRY_RUN([ 268 AC_RUN_IFELSE(
269 [AC_LANG_SOURCE([[
256]GL_NOCRASH[ 270]GL_NOCRASH[
257#include <float.h> 271#include <float.h>
258#include <stdio.h> 272#include <stdio.h>
@@ -279,35 +293,36 @@ static char buf[10000];
279static long double zeroL = 0.0L; 293static long double zeroL = 0.0L;
280int main () 294int main ()
281{ 295{
296 int result = 0;
282 nocrash_init(); 297 nocrash_init();
283 if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0 298 if (sprintf (buf, "%Lf", 1.0L / zeroL) < 0
284 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) 299 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
285 return 1; 300 result |= 1;
286 if (sprintf (buf, "%Lf", -1.0L / 0.0L) < 0 301 if (sprintf (buf, "%Lf", -1.0L / zeroL) < 0
287 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) 302 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
288 return 1; 303 result |= 1;
289 if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 304 if (sprintf (buf, "%Lf", zeroL / zeroL) < 0
290 || !strisnan (buf, 0, strlen (buf))) 305 || !strisnan (buf, 0, strlen (buf)))
291 return 1; 306 result |= 1;
292 if (sprintf (buf, "%Le", 1.0L / 0.0L) < 0 307 if (sprintf (buf, "%Le", 1.0L / zeroL) < 0
293 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) 308 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
294 return 1; 309 result |= 1;
295 if (sprintf (buf, "%Le", -1.0L / 0.0L) < 0 310 if (sprintf (buf, "%Le", -1.0L / zeroL) < 0
296 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) 311 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
297 return 1; 312 result |= 1;
298 if (sprintf (buf, "%Le", zeroL / zeroL) < 0 313 if (sprintf (buf, "%Le", zeroL / zeroL) < 0
299 || !strisnan (buf, 0, strlen (buf))) 314 || !strisnan (buf, 0, strlen (buf)))
300 return 1; 315 result |= 1;
301 if (sprintf (buf, "%Lg", 1.0L / 0.0L) < 0 316 if (sprintf (buf, "%Lg", 1.0L / zeroL) < 0
302 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) 317 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
303 return 1; 318 result |= 1;
304 if (sprintf (buf, "%Lg", -1.0L / 0.0L) < 0 319 if (sprintf (buf, "%Lg", -1.0L / zeroL) < 0
305 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) 320 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
306 return 1; 321 result |= 1;
307 if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 322 if (sprintf (buf, "%Lg", zeroL / zeroL) < 0
308 || !strisnan (buf, 0, strlen (buf))) 323 || !strisnan (buf, 0, strlen (buf)))
309 return 1; 324 result |= 1;
310#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) 325#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
311/* Representation of an 80-bit 'long double' as an initializer for a sequence 326/* Representation of an 80-bit 'long double' as an initializer for a sequence
312 of 'unsigned int' words. */ 327 of 'unsigned int' words. */
313# ifdef WORDS_BIGENDIAN 328# ifdef WORDS_BIGENDIAN
@@ -325,13 +340,13 @@ int main ()
325 { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; 340 { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
326 if (sprintf (buf, "%Lf", x.value) < 0 341 if (sprintf (buf, "%Lf", x.value) < 0
327 || !strisnan (buf, 0, strlen (buf))) 342 || !strisnan (buf, 0, strlen (buf)))
328 return 1; 343 result |= 2;
329 if (sprintf (buf, "%Le", x.value) < 0 344 if (sprintf (buf, "%Le", x.value) < 0
330 || !strisnan (buf, 0, strlen (buf))) 345 || !strisnan (buf, 0, strlen (buf)))
331 return 1; 346 result |= 2;
332 if (sprintf (buf, "%Lg", x.value) < 0 347 if (sprintf (buf, "%Lg", x.value) < 0
333 || !strisnan (buf, 0, strlen (buf))) 348 || !strisnan (buf, 0, strlen (buf)))
334 return 1; 349 result |= 2;
335 } 350 }
336 { 351 {
337 /* Signalling NaN. */ 352 /* Signalling NaN. */
@@ -339,113 +354,106 @@ int main ()
339 { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; 354 { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
340 if (sprintf (buf, "%Lf", x.value) < 0 355 if (sprintf (buf, "%Lf", x.value) < 0
341 || !strisnan (buf, 0, strlen (buf))) 356 || !strisnan (buf, 0, strlen (buf)))
342 return 1; 357 result |= 2;
343 if (sprintf (buf, "%Le", x.value) < 0 358 if (sprintf (buf, "%Le", x.value) < 0
344 || !strisnan (buf, 0, strlen (buf))) 359 || !strisnan (buf, 0, strlen (buf)))
345 return 1; 360 result |= 2;
346 if (sprintf (buf, "%Lg", x.value) < 0 361 if (sprintf (buf, "%Lg", x.value) < 0
347 || !strisnan (buf, 0, strlen (buf))) 362 || !strisnan (buf, 0, strlen (buf)))
348 return 1; 363 result |= 2;
349 } 364 }
350 { /* Pseudo-NaN. */ 365 { /* Pseudo-NaN. */
351 static union { unsigned int word[4]; long double value; } x = 366 static union { unsigned int word[4]; long double value; } x =
352 { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; 367 { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
353 if (sprintf (buf, "%Lf", x.value) < 0 368 if (sprintf (buf, "%Lf", x.value) < 0
354 || !strisnan (buf, 0, strlen (buf))) 369 || !strisnan (buf, 0, strlen (buf)))
355 return 1; 370 result |= 4;
356 if (sprintf (buf, "%Le", x.value) < 0 371 if (sprintf (buf, "%Le", x.value) < 0
357 || !strisnan (buf, 0, strlen (buf))) 372 || !strisnan (buf, 0, strlen (buf)))
358 return 1; 373 result |= 4;
359 if (sprintf (buf, "%Lg", x.value) < 0 374 if (sprintf (buf, "%Lg", x.value) < 0
360 || !strisnan (buf, 0, strlen (buf))) 375 || !strisnan (buf, 0, strlen (buf)))
361 return 1; 376 result |= 4;
362 } 377 }
363 { /* Pseudo-Infinity. */ 378 { /* Pseudo-Infinity. */
364 static union { unsigned int word[4]; long double value; } x = 379 static union { unsigned int word[4]; long double value; } x =
365 { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; 380 { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
366 if (sprintf (buf, "%Lf", x.value) < 0 381 if (sprintf (buf, "%Lf", x.value) < 0
367 || !strisnan (buf, 0, strlen (buf))) 382 || !strisnan (buf, 0, strlen (buf)))
368 return 1; 383 result |= 8;
369 if (sprintf (buf, "%Le", x.value) < 0 384 if (sprintf (buf, "%Le", x.value) < 0
370 || !strisnan (buf, 0, strlen (buf))) 385 || !strisnan (buf, 0, strlen (buf)))
371 return 1; 386 result |= 8;
372 if (sprintf (buf, "%Lg", x.value) < 0 387 if (sprintf (buf, "%Lg", x.value) < 0
373 || !strisnan (buf, 0, strlen (buf))) 388 || !strisnan (buf, 0, strlen (buf)))
374 return 1; 389 result |= 8;
375 } 390 }
376 { /* Pseudo-Zero. */ 391 { /* Pseudo-Zero. */
377 static union { unsigned int word[4]; long double value; } x = 392 static union { unsigned int word[4]; long double value; } x =
378 { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; 393 { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
379 if (sprintf (buf, "%Lf", x.value) < 0 394 if (sprintf (buf, "%Lf", x.value) < 0
380 || !strisnan (buf, 0, strlen (buf))) 395 || !strisnan (buf, 0, strlen (buf)))
381 return 1; 396 result |= 16;
382 if (sprintf (buf, "%Le", x.value) < 0 397 if (sprintf (buf, "%Le", x.value) < 0
383 || !strisnan (buf, 0, strlen (buf))) 398 || !strisnan (buf, 0, strlen (buf)))
384 return 1; 399 result |= 16;
385 if (sprintf (buf, "%Lg", x.value) < 0 400 if (sprintf (buf, "%Lg", x.value) < 0
386 || !strisnan (buf, 0, strlen (buf))) 401 || !strisnan (buf, 0, strlen (buf)))
387 return 1; 402 result |= 16;
388 } 403 }
389 { /* Unnormalized number. */ 404 { /* Unnormalized number. */
390 static union { unsigned int word[4]; long double value; } x = 405 static union { unsigned int word[4]; long double value; } x =
391 { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; 406 { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
392 if (sprintf (buf, "%Lf", x.value) < 0 407 if (sprintf (buf, "%Lf", x.value) < 0
393 || !strisnan (buf, 0, strlen (buf))) 408 || !strisnan (buf, 0, strlen (buf)))
394 return 1; 409 result |= 32;
395 if (sprintf (buf, "%Le", x.value) < 0 410 if (sprintf (buf, "%Le", x.value) < 0
396 || !strisnan (buf, 0, strlen (buf))) 411 || !strisnan (buf, 0, strlen (buf)))
397 return 1; 412 result |= 32;
398 if (sprintf (buf, "%Lg", x.value) < 0 413 if (sprintf (buf, "%Lg", x.value) < 0
399 || !strisnan (buf, 0, strlen (buf))) 414 || !strisnan (buf, 0, strlen (buf)))
400 return 1; 415 result |= 32;
401 } 416 }
402 { /* Pseudo-Denormal. */ 417 { /* Pseudo-Denormal. */
403 static union { unsigned int word[4]; long double value; } x = 418 static union { unsigned int word[4]; long double value; } x =
404 { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; 419 { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
405 if (sprintf (buf, "%Lf", x.value) < 0 420 if (sprintf (buf, "%Lf", x.value) < 0
406 || !strisnan (buf, 0, strlen (buf))) 421 || !strisnan (buf, 0, strlen (buf)))
407 return 1; 422 result |= 64;
408 if (sprintf (buf, "%Le", x.value) < 0 423 if (sprintf (buf, "%Le", x.value) < 0
409 || !strisnan (buf, 0, strlen (buf))) 424 || !strisnan (buf, 0, strlen (buf)))
410 return 1; 425 result |= 64;
411 if (sprintf (buf, "%Lg", x.value) < 0 426 if (sprintf (buf, "%Lg", x.value) < 0
412 || !strisnan (buf, 0, strlen (buf))) 427 || !strisnan (buf, 0, strlen (buf)))
413 return 1; 428 result |= 64;
414 } 429 }
415#endif 430#endif
416 return 0; 431 return result;
417}], 432}]])],
418 [gl_cv_func_printf_infinite_long_double=yes], 433 [gl_cv_func_printf_infinite_long_double=yes],
419 [gl_cv_func_printf_infinite_long_double=no], 434 [gl_cv_func_printf_infinite_long_double=no],
420 [ 435 [
421changequote(,)dnl 436changequote(,)dnl
422 case "$host_cpu" in 437 case "$host_cpu" in
423 # Guess no on ia64, x86_64, i386. 438 # Guess no on ia64, x86_64, i386.
424 ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; 439 ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";;
425 *) 440 *)
426 case "$host_os" in 441 case "$host_os" in
427 # Guess yes on glibc systems. 442 # Guess yes on glibc systems.
428 *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; 443 *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";;
429 # Guess yes on FreeBSD >= 6. 444 # Guess yes on FreeBSD >= 6.
430 freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";; 445 freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";;
431 freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; 446 freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
432 # Guess yes on MacOS X >= 10.3. 447 # Guess yes on HP-UX >= 11.
433 darwin[1-6].*) gl_cv_func_printf_infinite_long_double="guessing no";; 448 hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";;
434 darwin*) gl_cv_func_printf_infinite_long_double="guessing yes";; 449 hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";;
435 # Guess yes on HP-UX >= 11. 450 # If we don't know, assume the worst.
436 hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; 451 *) gl_cv_func_printf_infinite_long_double="guessing no";;
437 hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; 452 esac
438 # Guess yes on NetBSD >= 3. 453 ;;
439 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) 454 esac
440 gl_cv_func_printf_infinite_long_double="guessing no";;
441 netbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
442 # If we don't know, assume the worst.
443 *) gl_cv_func_printf_infinite_long_double="guessing no";;
444 esac
445 ;;
446 esac
447changequote([,])dnl 455changequote([,])dnl
448 ]) 456 ])
449 ]) 457 ])
450 ;; 458 ;;
451 *) 459 *)
@@ -466,72 +474,77 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_A],
466 AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives], 474 AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives],
467 [gl_cv_func_printf_directive_a], 475 [gl_cv_func_printf_directive_a],
468 [ 476 [
469 AC_TRY_RUN([ 477 AC_RUN_IFELSE(
478 [AC_LANG_SOURCE([[
470#include <stdio.h> 479#include <stdio.h>
471#include <string.h> 480#include <string.h>
472static char buf[100]; 481static char buf[100];
482static double zero = 0.0;
473int main () 483int main ()
474{ 484{
485 int result = 0;
475 if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 486 if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0
476 || (strcmp (buf, "0x1.922p+1 33") != 0 487 || (strcmp (buf, "0x1.922p+1 33") != 0
477 && strcmp (buf, "0x3.244p+0 33") != 0 488 && strcmp (buf, "0x3.244p+0 33") != 0
478 && strcmp (buf, "0x6.488p-1 33") != 0 489 && strcmp (buf, "0x6.488p-1 33") != 0
479 && strcmp (buf, "0xc.91p-2 33") != 0)) 490 && strcmp (buf, "0xc.91p-2 33") != 0))
480 return 1; 491 result |= 1;
481 if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 492 if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0
482 || (strcmp (buf, "-0X1.922P+1 33") != 0 493 || (strcmp (buf, "-0X1.922P+1 33") != 0
483 && strcmp (buf, "-0X3.244P+0 33") != 0 494 && strcmp (buf, "-0X3.244P+0 33") != 0
484 && strcmp (buf, "-0X6.488P-1 33") != 0 495 && strcmp (buf, "-0X6.488P-1 33") != 0
485 && strcmp (buf, "-0XC.91P-2 33") != 0)) 496 && strcmp (buf, "-0XC.91P-2 33") != 0))
486 return 1; 497 result |= 2;
487 /* This catches a FreeBSD 6.1 bug: it doesn't round. */ 498 /* This catches a FreeBSD 6.1 bug: it doesn't round. */
488 if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 499 if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0
489 || (strcmp (buf, "0x1.83p+0 33") != 0 500 || (strcmp (buf, "0x1.83p+0 33") != 0
490 && strcmp (buf, "0x3.05p-1 33") != 0 501 && strcmp (buf, "0x3.05p-1 33") != 0
491 && strcmp (buf, "0x6.0ap-2 33") != 0 502 && strcmp (buf, "0x6.0ap-2 33") != 0
492 && strcmp (buf, "0xc.14p-3 33") != 0)) 503 && strcmp (buf, "0xc.14p-3 33") != 0))
493 return 1; 504 result |= 4;
494 /* This catches a FreeBSD 6.1 bug. See 505 /* This catches a FreeBSD 6.1 bug. See
495 <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */ 506 <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
496 if (sprintf (buf, "%010a %d", 1.0 / 0.0, 33, 44, 55) < 0 507 if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0
497 || buf[0] == '0') 508 || buf[0] == '0')
498 return 1; 509 result |= 8;
499 /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug. */ 510 /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */
500 if (sprintf (buf, "%.1a", 1.999) < 0 511 if (sprintf (buf, "%.1a", 1.999) < 0
501 || (strcmp (buf, "0x1.0p+1") != 0 512 || (strcmp (buf, "0x1.0p+1") != 0
502 && strcmp (buf, "0x2.0p+0") != 0 513 && strcmp (buf, "0x2.0p+0") != 0
503 && strcmp (buf, "0x4.0p-1") != 0 514 && strcmp (buf, "0x4.0p-1") != 0
504 && strcmp (buf, "0x8.0p-2") != 0)) 515 && strcmp (buf, "0x8.0p-2") != 0))
505 return 1; 516 result |= 16;
506 /* This catches the same MacOS X 10.3.9 (Darwin 7.9) bug and also a 517 /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a
507 glibc 2.4 bug <http://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */ 518 glibc 2.4 bug <http://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */
508 if (sprintf (buf, "%.1La", 1.999L) < 0 519 if (sprintf (buf, "%.1La", 1.999L) < 0
509 || (strcmp (buf, "0x1.0p+1") != 0 520 || (strcmp (buf, "0x1.0p+1") != 0
510 && strcmp (buf, "0x2.0p+0") != 0 521 && strcmp (buf, "0x2.0p+0") != 0
511 && strcmp (buf, "0x4.0p-1") != 0 522 && strcmp (buf, "0x4.0p-1") != 0
512 && strcmp (buf, "0x8.0p-2") != 0)) 523 && strcmp (buf, "0x8.0p-2") != 0))
513 return 1; 524 result |= 32;
514 return 0; 525 return result;
515}], [gl_cv_func_printf_directive_a=yes], [gl_cv_func_printf_directive_a=no], 526}]])],
516 [ 527 [gl_cv_func_printf_directive_a=yes],
517 case "$host_os" in 528 [gl_cv_func_printf_directive_a=no],
518 # Guess yes on glibc >= 2.5 systems. 529 [
519 *-gnu*) 530 case "$host_os" in
520 AC_EGREP_CPP([BZ2908], [ 531 # Guess yes on glibc >= 2.5 systems.
521 #include <features.h> 532 *-gnu*)
522 #ifdef __GNU_LIBRARY__ 533 AC_EGREP_CPP([BZ2908], [
523 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2) 534 #include <features.h>
524 BZ2908 535 #ifdef __GNU_LIBRARY__
525 #endif 536 #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)) && !defined __UCLIBC__
526 #endif 537 BZ2908
527 ], 538 #endif
528 [gl_cv_func_printf_directive_a="guessing yes"], 539 #endif
529 [gl_cv_func_printf_directive_a="guessing no"]) 540 ],
530 ;; 541 [gl_cv_func_printf_directive_a="guessing yes"],
531 # If we don't know, assume the worst. 542 [gl_cv_func_printf_directive_a="guessing no"])
532 *) gl_cv_func_printf_directive_a="guessing no";; 543 ;;
533 esac 544 # If we don't know, assume the worst.
534 ]) 545 *) gl_cv_func_printf_directive_a="guessing no";;
546 esac
547 ])
535 ]) 548 ])
536]) 549])
537 550
@@ -546,43 +559,48 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_F],
546 AC_CACHE_CHECK([whether printf supports the 'F' directive], 559 AC_CACHE_CHECK([whether printf supports the 'F' directive],
547 [gl_cv_func_printf_directive_f], 560 [gl_cv_func_printf_directive_f],
548 [ 561 [
549 AC_TRY_RUN([ 562 AC_RUN_IFELSE(
563 [AC_LANG_SOURCE([[
550#include <stdio.h> 564#include <stdio.h>
551#include <string.h> 565#include <string.h>
552static char buf[100]; 566static char buf[100];
567static double zero = 0.0;
553int main () 568int main ()
554{ 569{
570 int result = 0;
555 if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 571 if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0
556 || strcmp (buf, "1234567.000000 33") != 0) 572 || strcmp (buf, "1234567.000000 33") != 0)
557 return 1; 573 result |= 1;
558 if (sprintf (buf, "%F", 1.0 / 0.0) < 0 574 if (sprintf (buf, "%F", 1.0 / zero) < 0
559 || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) 575 || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0))
560 return 1; 576 result |= 2;
561 /* This catches a Cygwin 1.5.x bug. */ 577 /* This catches a Cygwin 1.5.x bug. */
562 if (sprintf (buf, "%.F", 1234.0) < 0 578 if (sprintf (buf, "%.F", 1234.0) < 0
563 || strcmp (buf, "1234") != 0) 579 || strcmp (buf, "1234") != 0)
564 return 1; 580 result |= 4;
565 return 0; 581 return result;
566}], [gl_cv_func_printf_directive_f=yes], [gl_cv_func_printf_directive_f=no], 582}]])],
567 [ 583 [gl_cv_func_printf_directive_f=yes],
584 [gl_cv_func_printf_directive_f=no],
585 [
568changequote(,)dnl 586changequote(,)dnl
569 case "$host_os" in 587 case "$host_os" in
570 # Guess yes on glibc systems. 588 # Guess yes on glibc systems.
571 *-gnu*) gl_cv_func_printf_directive_f="guessing yes";; 589 *-gnu*) gl_cv_func_printf_directive_f="guessing yes";;
572 # Guess yes on FreeBSD >= 6. 590 # Guess yes on FreeBSD >= 6.
573 freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";; 591 freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";;
574 freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; 592 freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";;
575 # Guess yes on MacOS X >= 10.3. 593 # Guess yes on Mac OS X >= 10.3.
576 darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; 594 darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";;
577 darwin*) gl_cv_func_printf_directive_f="guessing yes";; 595 darwin*) gl_cv_func_printf_directive_f="guessing yes";;
578 # Guess yes on Solaris >= 2.10. 596 # Guess yes on Solaris >= 2.10.
579 solaris2.[0-9]*) gl_cv_func_printf_directive_f="guessing no";; 597 solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";;
580 solaris*) gl_cv_func_printf_directive_f="guessing yes";; 598 solaris*) gl_cv_func_printf_sizes_c99="guessing no";;
581 # If we don't know, assume the worst. 599 # If we don't know, assume the worst.
582 *) gl_cv_func_printf_directive_f="guessing no";; 600 *) gl_cv_func_printf_directive_f="guessing no";;
583 esac 601 esac
584changequote([,])dnl 602changequote([,])dnl
585 ]) 603 ])
586 ]) 604 ])
587]) 605])
588 606
@@ -597,14 +615,30 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N],
597 AC_CACHE_CHECK([whether printf supports the 'n' directive], 615 AC_CACHE_CHECK([whether printf supports the 'n' directive],
598 [gl_cv_func_printf_directive_n], 616 [gl_cv_func_printf_directive_n],
599 [ 617 [
600 AC_TRY_RUN([ 618 AC_RUN_IFELSE(
619 [AC_LANG_SOURCE([[
601#include <stdio.h> 620#include <stdio.h>
621#include <stdlib.h>
602#include <string.h> 622#include <string.h>
623#ifdef _MSC_VER
624/* See page about "Parameter Validation" on msdn.microsoft.com. */
625static void cdecl
626invalid_parameter_handler (const wchar_t *expression,
627 const wchar_t *function,
628 const wchar_t *file, unsigned int line,
629 uintptr_t dummy)
630{
631 exit (1);
632}
633#endif
603static char fmtstring[10]; 634static char fmtstring[10];
604static char buf[100]; 635static char buf[100];
605int main () 636int main ()
606{ 637{
607 int count = -1; 638 int count = -1;
639#ifdef _MSC_VER
640 _set_invalid_parameter_handler (invalid_parameter_handler);
641#endif
608 /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) 642 /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2)
609 support %n in format strings in read-only memory but not in writable 643 support %n in format strings in read-only memory but not in writable
610 memory. */ 644 memory. */
@@ -614,14 +648,17 @@ int main ()
614 || count != 4) 648 || count != 4)
615 return 1; 649 return 1;
616 return 0; 650 return 0;
617}], [gl_cv_func_printf_directive_n=yes], [gl_cv_func_printf_directive_n=no], 651}]])],
618 [ 652 [gl_cv_func_printf_directive_n=yes],
653 [gl_cv_func_printf_directive_n=no],
654 [
619changequote(,)dnl 655changequote(,)dnl
620 case "$host_os" in 656 case "$host_os" in
621 *) gl_cv_func_printf_directive_n="guessing yes";; 657 mingw*) gl_cv_func_printf_directive_n="guessing no";;
622 esac 658 *) gl_cv_func_printf_directive_n="guessing yes";;
659 esac
623changequote([,])dnl 660changequote([,])dnl
624 ]) 661 ])
625 ]) 662 ])
626]) 663])
627 664
@@ -639,7 +676,8 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_LS],
639 AC_CACHE_CHECK([whether printf supports the 'ls' directive], 676 AC_CACHE_CHECK([whether printf supports the 'ls' directive],
640 [gl_cv_func_printf_directive_ls], 677 [gl_cv_func_printf_directive_ls],
641 [ 678 [
642 AC_TRY_RUN([ 679 AC_RUN_IFELSE(
680 [AC_LANG_SOURCE([[
643/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before 681/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
644 <wchar.h>. 682 <wchar.h>.
645 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be 683 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
@@ -651,6 +689,7 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_LS],
651#include <string.h> 689#include <string.h>
652int main () 690int main ()
653{ 691{
692 int result = 0;
654 char buf[100]; 693 char buf[100];
655 /* Test whether %ls works at all. 694 /* Test whether %ls works at all.
656 This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on 695 This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on
@@ -660,7 +699,7 @@ int main ()
660 buf[0] = '\0'; 699 buf[0] = '\0';
661 if (sprintf (buf, "%ls", wstring) < 0 700 if (sprintf (buf, "%ls", wstring) < 0
662 || strcmp (buf, "abc") != 0) 701 || strcmp (buf, "abc") != 0)
663 return 1; 702 result |= 1;
664 } 703 }
665 /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an 704 /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an
666 assertion failure inside libc), but not on OpenBSD 4.0. */ 705 assertion failure inside libc), but not on OpenBSD 4.0. */
@@ -669,7 +708,7 @@ int main ()
669 buf[0] = '\0'; 708 buf[0] = '\0';
670 if (sprintf (buf, "%ls", wstring) < 0 709 if (sprintf (buf, "%ls", wstring) < 0
671 || strcmp (buf, "a") != 0) 710 || strcmp (buf, "a") != 0)
672 return 1; 711 result |= 2;
673 } 712 }
674 /* Test whether precisions in %ls are supported as specified in ISO C 99 713 /* Test whether precisions in %ls are supported as specified in ISO C 99
675 section 7.19.6.1: 714 section 7.19.6.1:
@@ -684,22 +723,24 @@ int main ()
684 buf[0] = '\0'; 723 buf[0] = '\0';
685 if (sprintf (buf, "%.2ls", wstring) < 0 724 if (sprintf (buf, "%.2ls", wstring) < 0
686 || strcmp (buf, "ab") != 0) 725 || strcmp (buf, "ab") != 0)
687 return 1; 726 result |= 8;
688 } 727 }
689 return 0; 728 return result;
690}], [gl_cv_func_printf_directive_ls=yes], [gl_cv_func_printf_directive_ls=no], 729}]])],
691 [ 730 [gl_cv_func_printf_directive_ls=yes],
731 [gl_cv_func_printf_directive_ls=no],
732 [
692changequote(,)dnl 733changequote(,)dnl
693 case "$host_os" in 734 case "$host_os" in
694 openbsd*) gl_cv_func_printf_directive_ls="guessing no";; 735 openbsd*) gl_cv_func_printf_directive_ls="guessing no";;
695 irix*) gl_cv_func_printf_directive_ls="guessing no";; 736 irix*) gl_cv_func_printf_directive_ls="guessing no";;
696 solaris*) gl_cv_func_printf_directive_ls="guessing no";; 737 solaris*) gl_cv_func_printf_directive_ls="guessing no";;
697 cygwin*) gl_cv_func_printf_directive_ls="guessing no";; 738 cygwin*) gl_cv_func_printf_directive_ls="guessing no";;
698 beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; 739 beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";;
699 *) gl_cv_func_printf_directive_ls="guessing yes";; 740 *) gl_cv_func_printf_directive_ls="guessing yes";;
700 esac 741 esac
701changequote([,])dnl 742changequote([,])dnl
702 ]) 743 ])
703 ]) 744 ])
704]) 745])
705 746
@@ -714,7 +755,8 @@ AC_DEFUN([gl_PRINTF_POSITIONS],
714 AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions], 755 AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions],
715 [gl_cv_func_printf_positions], 756 [gl_cv_func_printf_positions],
716 [ 757 [
717 AC_TRY_RUN([ 758 AC_RUN_IFELSE(
759 [AC_LANG_SOURCE([[
718#include <stdio.h> 760#include <stdio.h>
719#include <string.h> 761#include <string.h>
720/* The string "%2$d %1$d", with dollar characters protected from the shell's 762/* The string "%2$d %1$d", with dollar characters protected from the shell's
@@ -725,18 +767,20 @@ int main ()
725{ 767{
726 sprintf (buf, format, 33, 55); 768 sprintf (buf, format, 33, 55);
727 return (strcmp (buf, "55 33") != 0); 769 return (strcmp (buf, "55 33") != 0);
728}], [gl_cv_func_printf_positions=yes], [gl_cv_func_printf_positions=no], 770}]])],
729 [ 771 [gl_cv_func_printf_positions=yes],
772 [gl_cv_func_printf_positions=no],
773 [
730changequote(,)dnl 774changequote(,)dnl
731 case "$host_os" in 775 case "$host_os" in
732 netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) 776 netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*)
733 gl_cv_func_printf_positions="guessing no";; 777 gl_cv_func_printf_positions="guessing no";;
734 beos*) gl_cv_func_printf_positions="guessing no";; 778 beos*) gl_cv_func_printf_positions="guessing no";;
735 mingw* | pw*) gl_cv_func_printf_positions="guessing no";; 779 mingw* | pw*) gl_cv_func_printf_positions="guessing no";;
736 *) gl_cv_func_printf_positions="guessing yes";; 780 *) gl_cv_func_printf_positions="guessing yes";;
737 esac 781 esac
738changequote([,])dnl 782changequote([,])dnl
739 ]) 783 ])
740 ]) 784 ])
741]) 785])
742 786
@@ -751,7 +795,8 @@ AC_DEFUN([gl_PRINTF_FLAG_GROUPING],
751 AC_CACHE_CHECK([whether printf supports the grouping flag], 795 AC_CACHE_CHECK([whether printf supports the grouping flag],
752 [gl_cv_func_printf_flag_grouping], 796 [gl_cv_func_printf_flag_grouping],
753 [ 797 [
754 AC_TRY_RUN([ 798 AC_RUN_IFELSE(
799 [AC_LANG_SOURCE([[
755#include <stdio.h> 800#include <stdio.h>
756#include <string.h> 801#include <string.h>
757static char buf[100]; 802static char buf[100];
@@ -761,17 +806,19 @@ int main ()
761 || buf[strlen (buf) - 1] != '9') 806 || buf[strlen (buf) - 1] != '9')
762 return 1; 807 return 1;
763 return 0; 808 return 0;
764}], [gl_cv_func_printf_flag_grouping=yes], [gl_cv_func_printf_flag_grouping=no], 809}]])],
765 [ 810 [gl_cv_func_printf_flag_grouping=yes],
811 [gl_cv_func_printf_flag_grouping=no],
812 [
766changequote(,)dnl 813changequote(,)dnl
767 case "$host_os" in 814 case "$host_os" in
768 cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; 815 cygwin*) gl_cv_func_printf_flag_grouping="guessing no";;
769 netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; 816 netbsd*) gl_cv_func_printf_flag_grouping="guessing no";;
770 mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; 817 mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";;
771 *) gl_cv_func_printf_flag_grouping="guessing yes";; 818 *) gl_cv_func_printf_flag_grouping="guessing yes";;
772 esac 819 esac
773changequote([,])dnl 820changequote([,])dnl
774 ]) 821 ])
775 ]) 822 ])
776]) 823])
777 824
@@ -787,7 +834,8 @@ AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST],
787 AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly], 834 AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly],
788 [gl_cv_func_printf_flag_leftadjust], 835 [gl_cv_func_printf_flag_leftadjust],
789 [ 836 [
790 AC_TRY_RUN([ 837 AC_RUN_IFELSE(
838 [AC_LANG_SOURCE([[
791#include <stdio.h> 839#include <stdio.h>
792#include <string.h> 840#include <string.h>
793static char buf[100]; 841static char buf[100];
@@ -798,7 +846,7 @@ int main ()
798 || strcmp (buf, "ab c") != 0) 846 || strcmp (buf, "ab c") != 0)
799 return 1; 847 return 1;
800 return 0; 848 return 0;
801}], 849}]])],
802 [gl_cv_func_printf_flag_leftadjust=yes], 850 [gl_cv_func_printf_flag_leftadjust=yes],
803 [gl_cv_func_printf_flag_leftadjust=no], 851 [gl_cv_func_printf_flag_leftadjust=no],
804 [ 852 [
@@ -828,37 +876,44 @@ AC_DEFUN([gl_PRINTF_FLAG_ZERO],
828 AC_CACHE_CHECK([whether printf supports the zero flag correctly], 876 AC_CACHE_CHECK([whether printf supports the zero flag correctly],
829 [gl_cv_func_printf_flag_zero], 877 [gl_cv_func_printf_flag_zero],
830 [ 878 [
831 AC_TRY_RUN([ 879 AC_RUN_IFELSE(
880 [AC_LANG_SOURCE([[
832#include <stdio.h> 881#include <stdio.h>
833#include <string.h> 882#include <string.h>
834static char buf[100]; 883static char buf[100];
884static double zero = 0.0;
835int main () 885int main ()
836{ 886{
837 if (sprintf (buf, "%010f", 1.0 / 0.0, 33, 44, 55) < 0 887 if (sprintf (buf, "%010f", 1.0 / zero, 33, 44, 55) < 0
838 || (strcmp (buf, " inf") != 0 888 || (strcmp (buf, " inf") != 0
839 && strcmp (buf, " infinity") != 0)) 889 && strcmp (buf, " infinity") != 0))
840 return 1; 890 return 1;
841 return 0; 891 return 0;
842}], [gl_cv_func_printf_flag_zero=yes], [gl_cv_func_printf_flag_zero=no], 892}]])],
843 [ 893 [gl_cv_func_printf_flag_zero=yes],
894 [gl_cv_func_printf_flag_zero=no],
895 [
844changequote(,)dnl 896changequote(,)dnl
845 case "$host_os" in 897 case "$host_os" in
846 # Guess yes on glibc systems. 898 # Guess yes on glibc systems.
847 *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";; 899 *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";;
848 # Guess yes on BeOS. 900 # Guess yes on BeOS.
849 beos*) gl_cv_func_printf_flag_zero="guessing yes";; 901 beos*) gl_cv_func_printf_flag_zero="guessing yes";;
850 # If we don't know, assume the worst. 902 # If we don't know, assume the worst.
851 *) gl_cv_func_printf_flag_zero="guessing no";; 903 *) gl_cv_func_printf_flag_zero="guessing no";;
852 esac 904 esac
853changequote([,])dnl 905changequote([,])dnl
854 ]) 906 ])
855 ]) 907 ])
856]) 908])
857 909
858dnl Test whether the *printf family of functions supports large precisions. 910dnl Test whether the *printf family of functions supports large precisions.
859dnl On mingw, precisions larger than 512 are treated like 512, in integer, 911dnl On mingw, precisions larger than 512 are treated like 512, in integer,
860dnl floating-point or pointer output. On BeOS, precisions larger than 1044 912dnl floating-point or pointer output. On Solaris 10/x86, precisions larger
861dnl crash the program. 913dnl than 510 in floating-point output crash the program. On Solaris 10/SPARC,
914dnl precisions larger than 510 in floating-point output yield wrong results.
915dnl On AIX 7.1, precisions larger than 998 in floating-point output yield
916dnl wrong results. On BeOS, precisions larger than 1044 crash the program.
862dnl Result is gl_cv_func_printf_precision. 917dnl Result is gl_cv_func_printf_precision.
863 918
864AC_DEFUN([gl_PRINTF_PRECISION], 919AC_DEFUN([gl_PRINTF_PRECISION],
@@ -868,30 +923,43 @@ AC_DEFUN([gl_PRINTF_PRECISION],
868 AC_CACHE_CHECK([whether printf supports large precisions], 923 AC_CACHE_CHECK([whether printf supports large precisions],
869 [gl_cv_func_printf_precision], 924 [gl_cv_func_printf_precision],
870 [ 925 [
871 AC_TRY_RUN([ 926 AC_RUN_IFELSE(
927 [AC_LANG_SOURCE([[
872#include <stdio.h> 928#include <stdio.h>
873#include <string.h> 929#include <string.h>
874static char buf[5000]; 930static char buf[5000];
875int main () 931int main ()
876{ 932{
933 int result = 0;
877#ifdef __BEOS__ 934#ifdef __BEOS__
878 /* On BeOS, this would crash and show a dialog box. Avoid the crash. */ 935 /* On BeOS, this would crash and show a dialog box. Avoid the crash. */
879 return 1; 936 return 1;
880#endif 937#endif
881 if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3) 938 if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3)
882 return 1; 939 result |= 1;
883 return 0; 940 if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5)
884}], [gl_cv_func_printf_precision=yes], [gl_cv_func_printf_precision=no], 941 result |= 2;
885 [ 942 if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5
943 || buf[0] != '1')
944 result |= 4;
945 if (sprintf (buf, "%.999f %d", 1.0, 33, 44) < 999 + 5
946 || buf[0] != '1')
947 result |= 4;
948 return result;
949}]])],
950 [gl_cv_func_printf_precision=yes],
951 [gl_cv_func_printf_precision=no],
952 [
886changequote(,)dnl 953changequote(,)dnl
887 case "$host_os" in 954 case "$host_os" in
888 # Guess no only on native Win32 and BeOS systems. 955 # Guess no only on Solaris, native Windows, and BeOS systems.
889 mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; 956 solaris*) gl_cv_func_printf_precision="guessing no" ;;
890 beos*) gl_cv_func_printf_precision="guessing no" ;; 957 mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;;
891 *) gl_cv_func_printf_precision="guessing yes" ;; 958 beos*) gl_cv_func_printf_precision="guessing no" ;;
892 esac 959 *) gl_cv_func_printf_precision="guessing yes" ;;
960 esac
893changequote([,])dnl 961changequote([,])dnl
894 ]) 962 ])
895 ]) 963 ])
896]) 964])
897 965
@@ -960,8 +1028,9 @@ int main()
960changequote([,])dnl 1028changequote([,])dnl
961 ])]) 1029 ])])
962 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then 1030 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
963 (./conftest 1031 (./conftest 2>&AS_MESSAGE_LOG_FD
964 result=$? 1032 result=$?
1033 _AS_ECHO_LOG([\$? = $result])
965 if test $result != 0 && test $result != 77; then result=1; fi 1034 if test $result != 0 && test $result != 77; then result=1; fi
966 exit $result 1035 exit $result
967 ) >/dev/null 2>/dev/null 1036 ) >/dev/null 2>/dev/null
@@ -975,7 +1044,7 @@ changequote([,])dnl
975 fi 1044 fi
976 rm -fr conftest* 1045 rm -fr conftest*
977 else 1046 else
978 dnl A universal build on Apple MacOS X platforms. 1047 dnl A universal build on Apple Mac OS X platforms.
979 dnl The result would be 'no' in 32-bit mode and 'yes' in 64-bit mode. 1048 dnl The result would be 'no' in 32-bit mode and 'yes' in 64-bit mode.
980 dnl But we need a configuration result that is valid in both modes. 1049 dnl But we need a configuration result that is valid in both modes.
981 gl_cv_func_printf_enomem="guessing no" 1050 gl_cv_func_printf_enomem="guessing no"
@@ -1028,61 +1097,80 @@ AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99],
1028[ 1097[
1029 AC_REQUIRE([AC_PROG_CC]) 1098 AC_REQUIRE([AC_PROG_CC])
1030 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 1099 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
1100 AC_REQUIRE([gl_SNPRINTF_PRESENCE])
1031 AC_CACHE_CHECK([whether snprintf truncates the result as in C99], 1101 AC_CACHE_CHECK([whether snprintf truncates the result as in C99],
1032 [gl_cv_func_snprintf_truncation_c99], 1102 [gl_cv_func_snprintf_truncation_c99],
1033 [ 1103 [
1034 AC_TRY_RUN([ 1104 AC_RUN_IFELSE(
1105 [AC_LANG_SOURCE([[
1035#include <stdio.h> 1106#include <stdio.h>
1036#include <string.h> 1107#include <string.h>
1108#if HAVE_SNPRINTF
1109# define my_snprintf snprintf
1110#else
1111# include <stdarg.h>
1112static int my_snprintf (char *buf, int size, const char *format, ...)
1113{
1114 va_list args;
1115 int ret;
1116 va_start (args, format);
1117 ret = vsnprintf (buf, size, format, args);
1118 va_end (args);
1119 return ret;
1120}
1121#endif
1037static char buf[100]; 1122static char buf[100];
1038int main () 1123int main ()
1039{ 1124{
1040 strcpy (buf, "ABCDEF"); 1125 strcpy (buf, "ABCDEF");
1041 snprintf (buf, 3, "%d %d", 4567, 89); 1126 my_snprintf (buf, 3, "%d %d", 4567, 89);
1042 if (memcmp (buf, "45\0DEF", 6) != 0) 1127 if (memcmp (buf, "45\0DEF", 6) != 0)
1043 return 1; 1128 return 1;
1044 return 0; 1129 return 0;
1045}], [gl_cv_func_snprintf_truncation_c99=yes], [gl_cv_func_snprintf_truncation_c99=no], 1130}]])],
1046 [ 1131 [gl_cv_func_snprintf_truncation_c99=yes],
1132 [gl_cv_func_snprintf_truncation_c99=no],
1133 [
1047changequote(,)dnl 1134changequote(,)dnl
1048 case "$host_os" in 1135 case "$host_os" in
1049 # Guess yes on glibc systems. 1136 # Guess yes on glibc systems.
1050 *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1137 *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1051 # Guess yes on FreeBSD >= 5. 1138 # Guess yes on FreeBSD >= 5.
1052 freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; 1139 freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1053 freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1140 freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1054 # Guess yes on MacOS X >= 10.3. 1141 # Guess yes on Mac OS X >= 10.3.
1055 darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; 1142 darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1056 darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1143 darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1057 # Guess yes on OpenBSD >= 3.9. 1144 # Guess yes on OpenBSD >= 3.9.
1058 openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) 1145 openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
1059 gl_cv_func_snprintf_truncation_c99="guessing no";; 1146 gl_cv_func_snprintf_truncation_c99="guessing no";;
1060 openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1147 openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1061 # Guess yes on Solaris >= 2.6. 1148 # Guess yes on Solaris >= 2.6.
1062 solaris2.[0-5]*) gl_cv_func_snprintf_truncation_c99="guessing no";; 1149 solaris2.[0-5] | solaris2.[0-5].*)
1063 solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1150 gl_cv_func_snprintf_truncation_c99="guessing no";;
1064 # Guess yes on AIX >= 4. 1151 solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1065 aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";; 1152 # Guess yes on AIX >= 4.
1066 aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1153 aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1067 # Guess yes on HP-UX >= 11. 1154 aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1068 hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";; 1155 # Guess yes on HP-UX >= 11.
1069 hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1156 hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1070 # Guess yes on IRIX >= 6.5. 1157 hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1071 irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1158 # Guess yes on IRIX >= 6.5.
1072 # Guess yes on OSF/1 >= 5. 1159 irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1073 osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; 1160 # Guess yes on OSF/1 >= 5.
1074 osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1161 osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1075 # Guess yes on NetBSD >= 3. 1162 osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1076 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) 1163 # Guess yes on NetBSD >= 3.
1077 gl_cv_func_snprintf_truncation_c99="guessing no";; 1164 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
1078 netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1165 gl_cv_func_snprintf_truncation_c99="guessing no";;
1079 # Guess yes on BeOS. 1166 netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1080 beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1167 # Guess yes on BeOS.
1081 # If we don't know, assume the worst. 1168 beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1082 *) gl_cv_func_snprintf_truncation_c99="guessing no";; 1169 # If we don't know, assume the worst.
1083 esac 1170 *) gl_cv_func_snprintf_truncation_c99="guessing no";;
1171 esac
1084changequote([,])dnl 1172changequote([,])dnl
1085 ]) 1173 ])
1086 ]) 1174 ])
1087]) 1175])
1088 1176
@@ -1105,52 +1193,74 @@ AC_DEFUN_ONCE([gl_SNPRINTF_RETVAL_C99],
1105[ 1193[
1106 AC_REQUIRE([AC_PROG_CC]) 1194 AC_REQUIRE([AC_PROG_CC])
1107 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 1195 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
1196 AC_REQUIRE([gl_SNPRINTF_PRESENCE])
1108 AC_CACHE_CHECK([whether snprintf returns a byte count as in C99], 1197 AC_CACHE_CHECK([whether snprintf returns a byte count as in C99],
1109 [gl_cv_func_snprintf_retval_c99], 1198 [gl_cv_func_snprintf_retval_c99],
1110 [ 1199 [
1111 AC_TRY_RUN([ 1200 AC_RUN_IFELSE(
1201 [AC_LANG_SOURCE([[
1112#include <stdio.h> 1202#include <stdio.h>
1113#include <string.h> 1203#include <string.h>
1204#if HAVE_SNPRINTF
1205# define my_snprintf snprintf
1206#else
1207# include <stdarg.h>
1208static int my_snprintf (char *buf, int size, const char *format, ...)
1209{
1210 va_list args;
1211 int ret;
1212 va_start (args, format);
1213 ret = vsnprintf (buf, size, format, args);
1214 va_end (args);
1215 return ret;
1216}
1217#endif
1114static char buf[100]; 1218static char buf[100];
1115int main () 1219int main ()
1116{ 1220{
1117 strcpy (buf, "ABCDEF"); 1221 strcpy (buf, "ABCDEF");
1118 if (snprintf (buf, 3, "%d %d", 4567, 89) != 7) 1222 if (my_snprintf (buf, 3, "%d %d", 4567, 89) != 7)
1119 return 1; 1223 return 1;
1224 if (my_snprintf (buf, 0, "%d %d", 4567, 89) != 7)
1225 return 2;
1226 if (my_snprintf (NULL, 0, "%d %d", 4567, 89) != 7)
1227 return 3;
1120 return 0; 1228 return 0;
1121}], [gl_cv_func_snprintf_retval_c99=yes], [gl_cv_func_snprintf_retval_c99=no], 1229}]])],
1122 [ 1230 [gl_cv_func_snprintf_retval_c99=yes],
1231 [gl_cv_func_snprintf_retval_c99=no],
1232 [
1123changequote(,)dnl 1233changequote(,)dnl
1124 case "$host_os" in 1234 case "$host_os" in
1125 # Guess yes on glibc systems. 1235 # Guess yes on glibc systems.
1126 *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; 1236 *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1127 # Guess yes on FreeBSD >= 5. 1237 # Guess yes on FreeBSD >= 5.
1128 freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";; 1238 freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";;
1129 freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; 1239 freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1130 # Guess yes on MacOS X >= 10.3. 1240 # Guess yes on Mac OS X >= 10.3.
1131 darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; 1241 darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";;
1132 darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; 1242 darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1133 # Guess yes on OpenBSD >= 3.9. 1243 # Guess yes on OpenBSD >= 3.9.
1134 openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) 1244 openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
1135 gl_cv_func_snprintf_retval_c99="guessing no";; 1245 gl_cv_func_snprintf_retval_c99="guessing no";;
1136 openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; 1246 openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1137 # Guess yes on Solaris >= 2.6. 1247 # Guess yes on Solaris >= 2.10.
1138 solaris2.[0-5]*) gl_cv_func_snprintf_retval_c99="guessing no";; 1248 solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";;
1139 solaris*) gl_cv_func_snprintf_retval_c99="guessing yes";; 1249 solaris*) gl_cv_func_printf_sizes_c99="guessing no";;
1140 # Guess yes on AIX >= 4. 1250 # Guess yes on AIX >= 4.
1141 aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; 1251 aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";;
1142 aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; 1252 aix*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1143 # Guess yes on NetBSD >= 3. 1253 # Guess yes on NetBSD >= 3.
1144 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) 1254 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
1145 gl_cv_func_snprintf_retval_c99="guessing no";; 1255 gl_cv_func_snprintf_retval_c99="guessing no";;
1146 netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; 1256 netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1147 # Guess yes on BeOS. 1257 # Guess yes on BeOS.
1148 beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; 1258 beos*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1149 # If we don't know, assume the worst. 1259 # If we don't know, assume the worst.
1150 *) gl_cv_func_snprintf_retval_c99="guessing no";; 1260 *) gl_cv_func_snprintf_retval_c99="guessing no";;
1151 esac 1261 esac
1152changequote([,])dnl 1262changequote([,])dnl
1153 ]) 1263 ])
1154 ]) 1264 ])
1155]) 1265])
1156 1266
@@ -1162,12 +1272,28 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N],
1162[ 1272[
1163 AC_REQUIRE([AC_PROG_CC]) 1273 AC_REQUIRE([AC_PROG_CC])
1164 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 1274 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
1275 AC_REQUIRE([gl_SNPRINTF_PRESENCE])
1165 AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive], 1276 AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive],
1166 [gl_cv_func_snprintf_directive_n], 1277 [gl_cv_func_snprintf_directive_n],
1167 [ 1278 [
1168 AC_TRY_RUN([ 1279 AC_RUN_IFELSE(
1280 [AC_LANG_SOURCE([[
1169#include <stdio.h> 1281#include <stdio.h>
1170#include <string.h> 1282#include <string.h>
1283#if HAVE_SNPRINTF
1284# define my_snprintf snprintf
1285#else
1286# include <stdarg.h>
1287static int my_snprintf (char *buf, int size, const char *format, ...)
1288{
1289 va_list args;
1290 int ret;
1291 va_start (args, format);
1292 ret = vsnprintf (buf, size, format, args);
1293 va_end (args);
1294 return ret;
1295}
1296#endif
1171static char fmtstring[10]; 1297static char fmtstring[10];
1172static char buf[100]; 1298static char buf[100];
1173int main () 1299int main ()
@@ -1177,44 +1303,47 @@ int main ()
1177 support %n in format strings in read-only memory but not in writable 1303 support %n in format strings in read-only memory but not in writable
1178 memory. */ 1304 memory. */
1179 strcpy (fmtstring, "%d %n"); 1305 strcpy (fmtstring, "%d %n");
1180 snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55); 1306 my_snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55);
1181 if (count != 6) 1307 if (count != 6)
1182 return 1; 1308 return 1;
1183 return 0; 1309 return 0;
1184}], [gl_cv_func_snprintf_directive_n=yes], [gl_cv_func_snprintf_directive_n=no], 1310}]])],
1185 [ 1311 [gl_cv_func_snprintf_directive_n=yes],
1312 [gl_cv_func_snprintf_directive_n=no],
1313 [
1186changequote(,)dnl 1314changequote(,)dnl
1187 case "$host_os" in 1315 case "$host_os" in
1188 # Guess yes on glibc systems. 1316 # Guess yes on glibc systems.
1189 *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";; 1317 *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";;
1190 # Guess yes on FreeBSD >= 5. 1318 # Guess yes on FreeBSD >= 5.
1191 freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";; 1319 freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";;
1192 freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; 1320 freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
1193 # Guess yes on MacOS X >= 10.3. 1321 # Guess yes on Mac OS X >= 10.3.
1194 darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; 1322 darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";;
1195 darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; 1323 darwin*) gl_cv_func_snprintf_directive_n="guessing yes";;
1196 # Guess yes on Solaris >= 2.6. 1324 # Guess yes on Solaris >= 2.6.
1197 solaris2.[0-5]*) gl_cv_func_snprintf_directive_n="guessing no";; 1325 solaris2.[0-5] | solaris2.[0-5].*)
1198 solaris*) gl_cv_func_snprintf_directive_n="guessing yes";; 1326 gl_cv_func_snprintf_directive_n="guessing no";;
1199 # Guess yes on AIX >= 4. 1327 solaris*) gl_cv_func_snprintf_directive_n="guessing yes";;
1200 aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; 1328 # Guess yes on AIX >= 4.
1201 aix*) gl_cv_func_snprintf_directive_n="guessing yes";; 1329 aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";;
1202 # Guess yes on IRIX >= 6.5. 1330 aix*) gl_cv_func_snprintf_directive_n="guessing yes";;
1203 irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";; 1331 # Guess yes on IRIX >= 6.5.
1204 # Guess yes on OSF/1 >= 5. 1332 irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";;
1205 osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";; 1333 # Guess yes on OSF/1 >= 5.
1206 osf*) gl_cv_func_snprintf_directive_n="guessing yes";; 1334 osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";;
1207 # Guess yes on NetBSD >= 3. 1335 osf*) gl_cv_func_snprintf_directive_n="guessing yes";;
1208 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) 1336 # Guess yes on NetBSD >= 3.
1209 gl_cv_func_snprintf_directive_n="guessing no";; 1337 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
1210 netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; 1338 gl_cv_func_snprintf_directive_n="guessing no";;
1211 # Guess yes on BeOS. 1339 netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
1212 beos*) gl_cv_func_snprintf_directive_n="guessing yes";; 1340 # Guess yes on BeOS.
1213 # If we don't know, assume the worst. 1341 beos*) gl_cv_func_snprintf_directive_n="guessing yes";;
1214 *) gl_cv_func_snprintf_directive_n="guessing no";; 1342 # If we don't know, assume the worst.
1215 esac 1343 *) gl_cv_func_snprintf_directive_n="guessing no";;
1344 esac
1216changequote([,])dnl 1345changequote([,])dnl
1217 ]) 1346 ])
1218 ]) 1347 ])
1219]) 1348])
1220 1349
@@ -1226,20 +1355,36 @@ dnl Result is gl_cv_func_snprintf_size1.
1226AC_DEFUN([gl_SNPRINTF_SIZE1], 1355AC_DEFUN([gl_SNPRINTF_SIZE1],
1227[ 1356[
1228 AC_REQUIRE([AC_PROG_CC]) 1357 AC_REQUIRE([AC_PROG_CC])
1358 AC_REQUIRE([gl_SNPRINTF_PRESENCE])
1229 AC_CACHE_CHECK([whether snprintf respects a size of 1], 1359 AC_CACHE_CHECK([whether snprintf respects a size of 1],
1230 [gl_cv_func_snprintf_size1], 1360 [gl_cv_func_snprintf_size1],
1231 [ 1361 [
1232 AC_TRY_RUN([ 1362 AC_RUN_IFELSE(
1363 [AC_LANG_SOURCE([[
1233#include <stdio.h> 1364#include <stdio.h>
1365#if HAVE_SNPRINTF
1366# define my_snprintf snprintf
1367#else
1368# include <stdarg.h>
1369static int my_snprintf (char *buf, int size, const char *format, ...)
1370{
1371 va_list args;
1372 int ret;
1373 va_start (args, format);
1374 ret = vsnprintf (buf, size, format, args);
1375 va_end (args);
1376 return ret;
1377}
1378#endif
1234int main() 1379int main()
1235{ 1380{
1236 static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; 1381 static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
1237 snprintf (buf, 1, "%d", 12345); 1382 my_snprintf (buf, 1, "%d", 12345);
1238 return buf[1] != 'E'; 1383 return buf[1] != 'E';
1239}], 1384}]])],
1240 [gl_cv_func_snprintf_size1=yes], 1385 [gl_cv_func_snprintf_size1=yes],
1241 [gl_cv_func_snprintf_size1=no], 1386 [gl_cv_func_snprintf_size1=no],
1242 [gl_cv_func_snprintf_size1="guessing yes"]) 1387 [gl_cv_func_snprintf_size1="guessing yes"])
1243 ]) 1388 ])
1244]) 1389])
1245 1390
@@ -1286,7 +1431,8 @@ AC_DEFUN([gl_VSNPRINTF_ZEROSIZE_C99],
1286 AC_CACHE_CHECK([whether vsnprintf respects a zero size as in C99], 1431 AC_CACHE_CHECK([whether vsnprintf respects a zero size as in C99],
1287 [gl_cv_func_vsnprintf_zerosize_c99], 1432 [gl_cv_func_vsnprintf_zerosize_c99],
1288 [ 1433 [
1289 AC_TRY_RUN([ 1434 AC_RUN_IFELSE(
1435 [AC_LANG_SOURCE([[
1290#include <stdarg.h> 1436#include <stdarg.h>
1291#include <stdio.h> 1437#include <stdio.h>
1292static int my_snprintf (char *buf, int size, const char *format, ...) 1438static int my_snprintf (char *buf, int size, const char *format, ...)
@@ -1303,43 +1449,44 @@ int main()
1303 static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; 1449 static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
1304 my_snprintf (buf, 0, "%d", 12345); 1450 my_snprintf (buf, 0, "%d", 12345);
1305 return buf[0] != 'D'; 1451 return buf[0] != 'D';
1306}], 1452}]])],
1307 [gl_cv_func_vsnprintf_zerosize_c99=yes], 1453 [gl_cv_func_vsnprintf_zerosize_c99=yes],
1308 [gl_cv_func_vsnprintf_zerosize_c99=no], 1454 [gl_cv_func_vsnprintf_zerosize_c99=no],
1309 [ 1455 [
1310changequote(,)dnl 1456changequote(,)dnl
1311 case "$host_os" in 1457 case "$host_os" in
1312 # Guess yes on glibc systems. 1458 # Guess yes on glibc systems.
1313 *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1459 *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1314 # Guess yes on FreeBSD >= 5. 1460 # Guess yes on FreeBSD >= 5.
1315 freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; 1461 freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
1316 freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1462 freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1317 # Guess yes on MacOS X >= 10.3. 1463 # Guess yes on Mac OS X >= 10.3.
1318 darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; 1464 darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
1319 darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1465 darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1320 # Guess yes on Cygwin. 1466 # Guess yes on Cygwin.
1321 cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1467 cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1322 # Guess yes on Solaris >= 2.6. 1468 # Guess yes on Solaris >= 2.6.
1323 solaris2.[0-5]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; 1469 solaris2.[0-5] | solaris2.[0-5].*)
1324 solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1470 gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
1325 # Guess yes on AIX >= 4. 1471 solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1326 aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; 1472 # Guess yes on AIX >= 4.
1327 aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1473 aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
1328 # Guess yes on IRIX >= 6.5. 1474 aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1329 irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1475 # Guess yes on IRIX >= 6.5.
1330 # Guess yes on NetBSD >= 3. 1476 irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1331 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) 1477 # Guess yes on NetBSD >= 3.
1332 gl_cv_func_vsnprintf_zerosize_c99="guessing no";; 1478 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
1333 netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1479 gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
1334 # Guess yes on BeOS. 1480 netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1335 beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1481 # Guess yes on BeOS.
1336 # Guess yes on mingw. 1482 beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1337 mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1483 # Guess yes on mingw.
1338 # If we don't know, assume the worst. 1484 mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1339 *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; 1485 # If we don't know, assume the worst.
1340 esac 1486 *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
1487 esac
1341changequote([,])dnl 1488changequote([,])dnl
1342 ]) 1489 ])
1343 ]) 1490 ])
1344]) 1491])
1345 1492
@@ -1393,24 +1540,31 @@ dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1393dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . . 1540dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . .
1394dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . . 1541dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . .
1395dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . . 1542dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . .
1396dnl MacOS X 10.3.9 . . . . # . . . . . . # . # . . . . . . 1543dnl Mac OS X 10.5.8 . . . # # . . . . . . # . . . . . . . .
1544dnl Mac OS X 10.3.9 . . . . # . . . . . . # . # . . . . . .
1397dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . . 1545dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . .
1398dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . . 1546dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . .
1399dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . . 1547dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . .
1400dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . . 1548dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . .
1401dnl Solaris 10 . . # # # . . # . . . # . . . . . . . . 1549dnl Solaris 11 2011-11 . . # # # . . # . . . # . . . . . . . .
1402dnl Solaris 2.6 ... 9 # . # # # # . # . . . # . . . . . . . . 1550dnl Solaris 10 . . # # # . . # . . . # # . . . . . . .
1551dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . .
1403dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # # 1552dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # #
1553dnl AIX 7.1 . . # # # . . . . . . # # . . . . . . .
1404dnl AIX 5.2 . . # # # . . . . . . # . . . . . . . . 1554dnl AIX 5.2 . . # # # . . . . . . # . . . . . . . .
1405dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . . . . . 1555dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . # . . .
1406dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . . 1556dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . .
1407dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . # 1557dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . #
1408dnl HP-UX 10.20 # . # . # # . ? . . # # . . . . # # ? # 1558dnl HP-UX 10.20 # . # . # # . ? . . # # . . . . # # ? #
1409dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . . 1559dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . .
1410dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . # 1560dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . #
1411dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # # 1561dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # #
1562dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . .
1412dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ? 1563dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ?
1413dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . . 1564dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . .
1414dnl Haiku . . . # # # . # . . . . . ? . . . . . . 1565dnl Haiku . . . # # # . # . . . . . ? . . ? . . .
1415dnl BeOS # # . # # # . ? # . ? . # ? . . . . . . 1566dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . .
1416dnl mingw # # # # # # . . # # . # # ? . # # # . . 1567dnl old mingw / msvcrt # # # # # # . . # # . # # ? . # # # . .
1568dnl MSVC 9 # # # # # # # . # # . # # ? # # # # . .
1569dnl mingw 2009-2011 . # . # . . . . # # . . . ? . . . . . .
1570dnl mingw-w64 2011 # # # # # # . . # # . # # ? . # # # . .
diff --git a/gl/m4/progtest.m4 b/gl/m4/progtest.m4
index 2d804ac..7b39123 100644
--- a/gl/m4/progtest.m4
+++ b/gl/m4/progtest.m4
@@ -1,5 +1,5 @@
1# progtest.m4 serial 6 (gettext-0.18) 1# progtest.m4 serial 7 (gettext-0.18.2)
2dnl Copyright (C) 1996-2003, 2005, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 1996-2003, 2005, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -27,15 +27,14 @@ AC_DEFUN([AM_PATH_PROG_WITH_TEST],
27# Prepare PATH_SEPARATOR. 27# Prepare PATH_SEPARATOR.
28# The user is always right. 28# The user is always right.
29if test "${PATH_SEPARATOR+set}" != set; then 29if test "${PATH_SEPARATOR+set}" != set; then
30 echo "#! /bin/sh" >conf$$.sh 30 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
31 echo "exit 0" >>conf$$.sh 31 # contains only /bin. Note that ksh looks also at the FPATH variable,
32 chmod +x conf$$.sh 32 # so we have to set that as well for the test.
33 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then 33 PATH_SEPARATOR=:
34 PATH_SEPARATOR=';' 34 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
35 else 35 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
36 PATH_SEPARATOR=: 36 || PATH_SEPARATOR=';'
37 fi 37 }
38 rm -f conf$$.sh
39fi 38fi
40 39
41# Find out how to test for executable files. Don't use a zero-byte file, 40# Find out how to test for executable files. Don't use a zero-byte file,
diff --git a/gl/m4/read.m4 b/gl/m4/read.m4
new file mode 100644
index 0000000..81f0f3a
--- /dev/null
+++ b/gl/m4/read.m4
@@ -0,0 +1,26 @@
1# read.m4 serial 4
2dnl Copyright (C) 2011-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_READ],
8[
9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
10 AC_REQUIRE([gl_MSVC_INVAL])
11 if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
12 REPLACE_READ=1
13 fi
14 dnl This ifdef is just an optimization, to avoid performing a configure
15 dnl check whose result is not used. It does not make the test of
16 dnl GNULIB_UNISTD_H_NONBLOCKING or GNULIB_NONBLOCKING redundant.
17 m4_ifdef([gl_NONBLOCKING_IO], [
18 gl_NONBLOCKING_IO
19 if test $gl_cv_have_nonblocking != yes; then
20 REPLACE_READ=1
21 fi
22 ])
23])
24
25# Prerequisites of lib/read.c.
26AC_DEFUN([gl_PREREQ_READ], [:])
diff --git a/gl/m4/regex.m4 b/gl/m4/regex.m4
index 95784e4..0945c11 100644
--- a/gl/m4/regex.m4
+++ b/gl/m4/regex.m4
@@ -1,7 +1,6 @@
1# serial 56 1# serial 64
2 2
3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 3# Copyright (C) 1996-2001, 2003-2013 Free Software Foundation, Inc.
4# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5# 4#
6# This file is free software; the Free Software Foundation 5# This file is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it, 6# gives unlimited permission to copy and/or distribute it,
@@ -14,8 +13,6 @@ AC_PREREQ([2.50])
14 13
15AC_DEFUN([gl_REGEX], 14AC_DEFUN([gl_REGEX],
16[ 15[
17 AC_CHECK_HEADERS_ONCE([locale.h])
18
19 AC_ARG_WITH([included-regex], 16 AC_ARG_WITH([included-regex],
20 [AS_HELP_STRING([--without-included-regex], 17 [AS_HELP_STRING([--without-included-regex],
21 [don't compile regex; this is the default on systems 18 [don't compile regex; this is the default on systems
@@ -30,31 +27,41 @@ AC_DEFUN([gl_REGEX],
30 # following run test, then default to *not* using the included regex.c. 27 # following run test, then default to *not* using the included regex.c.
31 # If cross compiling, assume the test would fail and use the included 28 # If cross compiling, assume the test would fail and use the included
32 # regex.c. 29 # regex.c.
30 AC_CHECK_DECLS_ONCE([alarm])
33 AC_CACHE_CHECK([for working re_compile_pattern], 31 AC_CACHE_CHECK([for working re_compile_pattern],
34 [gl_cv_func_re_compile_pattern_working], 32 [gl_cv_func_re_compile_pattern_working],
35 [AC_RUN_IFELSE( 33 [AC_RUN_IFELSE(
36 [AC_LANG_PROGRAM( 34 [AC_LANG_PROGRAM(
37 [AC_INCLUDES_DEFAULT[ 35 [[#include <regex.h>
38 #if HAVE_LOCALE_H 36
39 #include <locale.h> 37 #include <locale.h>
40 #endif 38 #include <limits.h>
41 #include <limits.h> 39 #include <string.h>
42 #include <regex.h> 40 #if HAVE_DECL_ALARM
43 ]], 41 # include <unistd.h>
44 [[static struct re_pattern_buffer regex; 42 # include <signal.h>
43 #endif
44 ]],
45 [[int result = 0;
46 static struct re_pattern_buffer regex;
45 unsigned char folded_chars[UCHAR_MAX + 1]; 47 unsigned char folded_chars[UCHAR_MAX + 1];
46 int i; 48 int i;
47 const char *s; 49 const char *s;
48 struct re_registers regs; 50 struct re_registers regs;
49 51
50 #if HAVE_LOCALE_H 52#if HAVE_DECL_ALARM
51 /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html 53 /* Some builds of glibc go into an infinite loop on this test. */
52 This test needs valgrind to catch the bug on Debian 54 signal (SIGALRM, SIG_DFL);
53 GNU/Linux 3.1 x86, but it might catch the bug better 55 alarm (2);
54 on other platforms and it shouldn't hurt to try the 56#endif
55 test here. */ 57 if (setlocale (LC_ALL, "en_US.UTF-8"))
56 if (setlocale (LC_ALL, "en_US.UTF-8")) 58 {
57 { 59 {
60 /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html
61 This test needs valgrind to catch the bug on Debian
62 GNU/Linux 3.1 x86, but it might catch the bug better
63 on other platforms and it shouldn't hurt to try the
64 test here. */
58 static char const pat[] = "insert into"; 65 static char const pat[] = "insert into";
59 static char const data[] = 66 static char const data[] =
60 "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK"; 67 "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK";
@@ -63,26 +70,57 @@ AC_DEFUN([gl_REGEX],
63 memset (&regex, 0, sizeof regex); 70 memset (&regex, 0, sizeof regex);
64 s = re_compile_pattern (pat, sizeof pat - 1, &regex); 71 s = re_compile_pattern (pat, sizeof pat - 1, &regex);
65 if (s) 72 if (s)
66 return 1; 73 result |= 1;
67 if (re_search (&regex, data, sizeof data - 1, 74 else if (re_search (&regex, data, sizeof data - 1,
68 0, sizeof data - 1, &regs) 75 0, sizeof data - 1, &regs)
69 != -1) 76 != -1)
70 return 1; 77 result |= 1;
71 if (! setlocale (LC_ALL, "C"))
72 return 1;
73 } 78 }
74 #endif 79
80 {
81 /* This test is from glibc bug 15078.
82 The test case is from Andreas Schwab in
83 <http://www.sourceware.org/ml/libc-alpha/2013-01/msg00967.html>.
84 */
85 static char const pat[] = "[^x]x";
86 static char const data[] =
87 /* <U1000><U103B><U103D><U1014><U103A><U102F><U1015><U103A> */
88 "\xe1\x80\x80"
89 "\xe1\x80\xbb"
90 "\xe1\x80\xbd"
91 "\xe1\x80\x94"
92 "\xe1\x80\xba"
93 "\xe1\x80\xaf"
94 "\xe1\x80\x95"
95 "\xe1\x80\xba"
96 "x";
97 re_set_syntax (0);
98 memset (&regex, 0, sizeof regex);
99 s = re_compile_pattern (pat, sizeof pat - 1, &regex);
100 if (s)
101 result |= 1;
102 else
103 {
104 i = re_search (&regex, data, sizeof data - 1,
105 0, sizeof data - 1, 0);
106 if (i != 0 && i != 21)
107 result |= 1;
108 }
109 }
110
111 if (! setlocale (LC_ALL, "C"))
112 return 1;
113 }
75 114
76 /* This test is from glibc bug 3957, reported by Andrew Mackey. */ 115 /* This test is from glibc bug 3957, reported by Andrew Mackey. */
77 re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE); 116 re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE);
78 memset (&regex, 0, sizeof regex); 117 memset (&regex, 0, sizeof regex);
79 s = re_compile_pattern ("a[^x]b", 6, &regex); 118 s = re_compile_pattern ("a[^x]b", 6, &regex);
80 if (s) 119 if (s)
81 return 1; 120 result |= 2;
82
83 /* This should fail, but succeeds for glibc-2.5. */ 121 /* This should fail, but succeeds for glibc-2.5. */
84 if (re_search (&regex, "a\nb", 3, 0, 3, &regs) != -1) 122 else if (re_search (&regex, "a\nb", 3, 0, 3, &regs) != -1)
85 return 1; 123 result |= 2;
86 124
87 /* This regular expression is from Spencer ere test number 75 125 /* This regular expression is from Spencer ere test number 75
88 in grep-2.3. */ 126 in grep-2.3. */
@@ -94,7 +132,7 @@ AC_DEFUN([gl_REGEX],
94 s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, &regex); 132 s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, &regex);
95 /* This should fail with _Invalid character class name_ error. */ 133 /* This should fail with _Invalid character class name_ error. */
96 if (!s) 134 if (!s)
97 return 1; 135 result |= 4;
98 136
99 /* Ensure that [b-a] is diagnosed as invalid, when 137 /* Ensure that [b-a] is diagnosed as invalid, when
100 using RE_NO_EMPTY_RANGES. */ 138 using RE_NO_EMPTY_RANGES. */
@@ -102,34 +140,31 @@ AC_DEFUN([gl_REGEX],
102 memset (&regex, 0, sizeof regex); 140 memset (&regex, 0, sizeof regex);
103 s = re_compile_pattern ("a[b-a]", 6, &regex); 141 s = re_compile_pattern ("a[b-a]", 6, &regex);
104 if (s == 0) 142 if (s == 0)
105 return 1; 143 result |= 8;
106 144
107 /* This should succeed, but does not for glibc-2.1.3. */ 145 /* This should succeed, but does not for glibc-2.1.3. */
108 memset (&regex, 0, sizeof regex); 146 memset (&regex, 0, sizeof regex);
109 s = re_compile_pattern ("{1", 2, &regex); 147 s = re_compile_pattern ("{1", 2, &regex);
110
111 if (s) 148 if (s)
112 return 1; 149 result |= 8;
113 150
114 /* The following example is derived from a problem report 151 /* The following example is derived from a problem report
115 against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */ 152 against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */
116 memset (&regex, 0, sizeof regex); 153 memset (&regex, 0, sizeof regex);
117 s = re_compile_pattern ("[an\371]*n", 7, &regex); 154 s = re_compile_pattern ("[an\371]*n", 7, &regex);
118 if (s) 155 if (s)
119 return 1; 156 result |= 8;
120
121 /* This should match, but does not for glibc-2.2.1. */ 157 /* This should match, but does not for glibc-2.2.1. */
122 if (re_match (&regex, "an", 2, 0, &regs) != 2) 158 else if (re_match (&regex, "an", 2, 0, &regs) != 2)
123 return 1; 159 result |= 8;
124 160
125 memset (&regex, 0, sizeof regex); 161 memset (&regex, 0, sizeof regex);
126 s = re_compile_pattern ("x", 1, &regex); 162 s = re_compile_pattern ("x", 1, &regex);
127 if (s) 163 if (s)
128 return 1; 164 result |= 8;
129
130 /* glibc-2.2.93 does not work with a negative RANGE argument. */ 165 /* glibc-2.2.93 does not work with a negative RANGE argument. */
131 if (re_search (&regex, "wxy", 3, 2, -2, &regs) != 1) 166 else if (re_search (&regex, "wxy", 3, 2, -2, &regs) != 1)
132 return 1; 167 result |= 8;
133 168
134 /* The version of regex.c in older versions of gnulib 169 /* The version of regex.c in older versions of gnulib
135 ignored RE_ICASE. Detect that problem too. */ 170 ignored RE_ICASE. Detect that problem too. */
@@ -137,10 +172,9 @@ AC_DEFUN([gl_REGEX],
137 memset (&regex, 0, sizeof regex); 172 memset (&regex, 0, sizeof regex);
138 s = re_compile_pattern ("x", 1, &regex); 173 s = re_compile_pattern ("x", 1, &regex);
139 if (s) 174 if (s)
140 return 1; 175 result |= 16;
141 176 else if (re_search (&regex, "WXY", 3, 0, 3, &regs) < 0)
142 if (re_search (&regex, "WXY", 3, 0, 3, &regs) < 0) 177 result |= 16;
143 return 1;
144 178
145 /* Catch a bug reported by Vin Shelton in 179 /* Catch a bug reported by Vin Shelton in
146 http://lists.gnu.org/archive/html/bug-coreutils/2007-06/msg00089.html 180 http://lists.gnu.org/archive/html/bug-coreutils/2007-06/msg00089.html
@@ -151,21 +185,27 @@ AC_DEFUN([gl_REGEX],
151 memset (&regex, 0, sizeof regex); 185 memset (&regex, 0, sizeof regex);
152 s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, &regex); 186 s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, &regex);
153 if (s) 187 if (s)
154 return 1; 188 result |= 32;
155 189
156 /* REG_STARTEND was added to glibc on 2004-01-15. 190 /* REG_STARTEND was added to glibc on 2004-01-15.
157 Reject older versions. */ 191 Reject older versions. */
158 if (! REG_STARTEND) 192 if (! REG_STARTEND)
159 return 1; 193 result |= 64;
160 194
161 /* Reject hosts whose regoff_t values are too narrow. 195#if 0
162 These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t 196 /* It would be nice to reject hosts whose regoff_t values are too
163 and 32-bit int. */ 197 narrow (including glibc on hosts with 64-bit ptrdiff_t and
198 32-bit int), but we should wait until glibc implements this
199 feature. Otherwise, support for equivalence classes and
200 multibyte collation symbols would always be broken except
201 when compiling --without-included-regex. */
164 if (sizeof (regoff_t) < sizeof (ptrdiff_t) 202 if (sizeof (regoff_t) < sizeof (ptrdiff_t)
165 || sizeof (regoff_t) < sizeof (ssize_t)) 203 || sizeof (regoff_t) < sizeof (ssize_t))
166 return 1; 204 result |= 64;
205#endif
167 206
168 return 0;]])], 207 return result;
208 ]])],
169 [gl_cv_func_re_compile_pattern_working=yes], 209 [gl_cv_func_re_compile_pattern_working=yes],
170 [gl_cv_func_re_compile_pattern_working=no], 210 [gl_cv_func_re_compile_pattern_working=no],
171 dnl When crosscompiling, assume it is not working. 211 dnl When crosscompiling, assume it is not working.
@@ -180,6 +220,9 @@ AC_DEFUN([gl_REGEX],
180 esac 220 esac
181 221
182 if test $ac_use_included_regex = yes; then 222 if test $ac_use_included_regex = yes; then
223 AC_DEFINE([_REGEX_INCLUDE_LIMITS_H], [1],
224 [Define if you want <regex.h> to include <limits.h>, so that it
225 consistently overrides <limits.h>'s RE_DUP_MAX.])
183 AC_DEFINE([_REGEX_LARGE_OFFSETS], [1], 226 AC_DEFINE([_REGEX_LARGE_OFFSETS], [1],
184 [Define if you want regoff_t to be at least as wide POSIX requires.]) 227 [Define if you want regoff_t to be at least as wide POSIX requires.])
185 AC_DEFINE([re_syntax_options], [rpl_re_syntax_options], 228 AC_DEFINE([re_syntax_options], [rpl_re_syntax_options],
@@ -212,8 +255,6 @@ AC_DEFUN([gl_REGEX],
212 [Define to rpl_regerror if the replacement should be used.]) 255 [Define to rpl_regerror if the replacement should be used.])
213 AC_DEFINE([regfree], [rpl_regfree], 256 AC_DEFINE([regfree], [rpl_regfree],
214 [Define to rpl_regfree if the replacement should be used.]) 257 [Define to rpl_regfree if the replacement should be used.])
215 AC_LIBOBJ([regex])
216 gl_PREREQ_REGEX
217 fi 258 fi
218]) 259])
219 260
@@ -224,7 +265,9 @@ AC_DEFUN([gl_PREREQ_REGEX],
224 AC_REQUIRE([AC_C_INLINE]) 265 AC_REQUIRE([AC_C_INLINE])
225 AC_REQUIRE([AC_C_RESTRICT]) 266 AC_REQUIRE([AC_C_RESTRICT])
226 AC_REQUIRE([AC_TYPE_MBSTATE_T]) 267 AC_REQUIRE([AC_TYPE_MBSTATE_T])
268 AC_REQUIRE([gl_EEMALLOC])
269 AC_REQUIRE([gl_GLIBC21])
227 AC_CHECK_HEADERS([libintl.h]) 270 AC_CHECK_HEADERS([libintl.h])
228 AC_CHECK_FUNCS_ONCE([isblank iswctype wcscoll]) 271 AC_CHECK_FUNCS_ONCE([isblank iswctype wcscoll])
229 AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>]) 272 AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]])
230]) 273])
diff --git a/gl/m4/safe-read.m4 b/gl/m4/safe-read.m4
index d087bd3..be5207a 100644
--- a/gl/m4/safe-read.m4
+++ b/gl/m4/safe-read.m4
@@ -1,17 +1,10 @@
1# safe-read.m4 serial 5 1# safe-read.m4 serial 6
2dnl Copyright (C) 2002-2003, 2005-2006, 2009-2010 Free Software Foundation, 2dnl Copyright (C) 2002-2003, 2005-2006, 2009-2013 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7 7
8AC_DEFUN([gl_SAFE_READ],
9[
10 AC_LIBOBJ([safe-read])
11
12 gl_PREREQ_SAFE_READ
13])
14
15# Prerequisites of lib/safe-read.c. 8# Prerequisites of lib/safe-read.c.
16AC_DEFUN([gl_PREREQ_SAFE_READ], 9AC_DEFUN([gl_PREREQ_SAFE_READ],
17[ 10[
diff --git a/gl/m4/safe-write.m4 b/gl/m4/safe-write.m4
deleted file mode 100644
index 2ff11d2..0000000
--- a/gl/m4/safe-write.m4
+++ /dev/null
@@ -1,18 +0,0 @@
1# safe-write.m4 serial 3
2dnl Copyright (C) 2002, 2005-2006, 2009-2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_SAFE_WRITE],
8[
9 AC_LIBOBJ([safe-write])
10
11 gl_PREREQ_SAFE_WRITE
12])
13
14# Prerequisites of lib/safe-write.c.
15AC_DEFUN([gl_PREREQ_SAFE_WRITE],
16[
17 gl_PREREQ_SAFE_READ
18])
diff --git a/gl/m4/servent.m4 b/gl/m4/servent.m4
index 2ed961a..01c037a 100644
--- a/gl/m4/servent.m4
+++ b/gl/m4/servent.m4
@@ -1,5 +1,5 @@
1# servent.m4 serial 1 1# servent.m4 serial 2
2dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2008, 2010-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -30,12 +30,16 @@ AC_DEFUN([gl_SERVENT],
30 [gl_cv_w32_getservbyname=no 30 [gl_cv_w32_getservbyname=no
31 gl_save_LIBS="$LIBS" 31 gl_save_LIBS="$LIBS"
32 LIBS="$LIBS -lws2_32" 32 LIBS="$LIBS -lws2_32"
33 AC_TRY_LINK([ 33 AC_LINK_IFELSE(
34 [AC_LANG_PROGRAM(
35 [[
34#ifdef HAVE_WINSOCK2_H 36#ifdef HAVE_WINSOCK2_H
35#include <winsock2.h> 37#include <winsock2.h>
36#endif 38#endif
37#include <stddef.h> 39#include <stddef.h>
38], [getservbyname(NULL,NULL);], [gl_cv_w32_getservbyname=yes]) 40 ]],
41 [[getservbyname(NULL,NULL);]])],
42 [gl_cv_w32_getservbyname=yes])
39 LIBS="$gl_save_LIBS" 43 LIBS="$gl_save_LIBS"
40 ]) 44 ])
41 if test "$gl_cv_w32_getservbyname" = "yes"; then 45 if test "$gl_cv_w32_getservbyname" = "yes"; then
diff --git a/gl/m4/setenv.m4 b/gl/m4/setenv.m4
index 58f6d13..cb5351a 100644
--- a/gl/m4/setenv.m4
+++ b/gl/m4/setenv.m4
@@ -1,5 +1,5 @@
1# setenv.m4 serial 16 1# setenv.m4 serial 26
2dnl Copyright (C) 2001-2004, 2006-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2004, 2006-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -7,16 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
7AC_DEFUN([gl_FUNC_SETENV], 7AC_DEFUN([gl_FUNC_SETENV],
8[ 8[
9 AC_REQUIRE([gl_FUNC_SETENV_SEPARATE]) 9 AC_REQUIRE([gl_FUNC_SETENV_SEPARATE])
10 if test $HAVE_SETENV$REPLACE_SETENV != 10; then 10 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
11 AC_LIBOBJ([setenv])
12 fi
13])
14
15# Like gl_FUNC_SETENV, except prepare for separate compilation (no AC_LIBOBJ).
16AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
17[
18 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
19 AC_CHECK_FUNCS_ONCE([setenv])
20 if test $ac_cv_func_setenv = no; then 11 if test $ac_cv_func_setenv = no; then
21 HAVE_SETENV=0 12 HAVE_SETENV=0
22 else 13 else
@@ -27,69 +18,127 @@ AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
27 #include <errno.h> 18 #include <errno.h>
28 #include <string.h> 19 #include <string.h>
29 ]], [[ 20 ]], [[
30 if (setenv ("", "", 0) != -1) return 1; 21 int result = 0;
31 if (errno != EINVAL) return 2; 22 {
32 if (setenv ("a", "=", 1) != 0) return 3; 23 if (setenv ("", "", 0) != -1)
33 if (strcmp (getenv ("a"), "=") != 0) return 4; 24 result |= 1;
25 else if (errno != EINVAL)
26 result |= 2;
27 }
28 {
29 if (setenv ("a", "=", 1) != 0)
30 result |= 4;
31 else if (strcmp (getenv ("a"), "=") != 0)
32 result |= 8;
33 }
34 return result;
34 ]])], 35 ]])],
35 [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no], 36 [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no],
36 [gl_cv_func_setenv_works="guessing no"])]) 37 [case "$host_os" in
37 if test "$gl_cv_func_setenv_works" != yes; then 38 # Guess yes on glibc systems.
38 REPLACE_SETENV=1 39 *-gnu*) gl_cv_func_setenv_works="guessing yes" ;;
39 AC_LIBOBJ([setenv]) 40 # If we don't know, assume the worst.
40 fi 41 *) gl_cv_func_setenv_works="guessing no" ;;
42 esac
43 ])])
44 case "$gl_cv_func_setenv_works" in
45 *yes) ;;
46 *)
47 REPLACE_SETENV=1
48 ;;
49 esac
41 fi 50 fi
51])
52
53# Like gl_FUNC_SETENV, except prepare for separate compilation
54# (no REPLACE_SETENV, no AC_LIBOBJ).
55AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
56[
57 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
58 AC_CHECK_DECLS_ONCE([setenv])
59 if test $ac_cv_have_decl_setenv = no; then
60 HAVE_DECL_SETENV=0
61 fi
62 AC_CHECK_FUNCS_ONCE([setenv])
42 gl_PREREQ_SETENV 63 gl_PREREQ_SETENV
43]) 64])
44 65
45AC_DEFUN([gl_FUNC_UNSETENV], 66AC_DEFUN([gl_FUNC_UNSETENV],
46[ 67[
47 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 68 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
69 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
70 AC_CHECK_DECLS_ONCE([unsetenv])
71 if test $ac_cv_have_decl_unsetenv = no; then
72 HAVE_DECL_UNSETENV=0
73 fi
48 AC_CHECK_FUNCS([unsetenv]) 74 AC_CHECK_FUNCS([unsetenv])
49 if test $ac_cv_func_unsetenv = no; then 75 if test $ac_cv_func_unsetenv = no; then
50 HAVE_UNSETENV=0 76 HAVE_UNSETENV=0
51 AC_LIBOBJ([unsetenv])
52 gl_PREREQ_UNSETENV
53 else 77 else
78 HAVE_UNSETENV=1
54 dnl Some BSDs return void, failing to do error checking. 79 dnl Some BSDs return void, failing to do error checking.
55 AC_CACHE_CHECK([for unsetenv() return type], [gt_cv_func_unsetenv_ret], 80 AC_CACHE_CHECK([for unsetenv() return type], [gt_cv_func_unsetenv_ret],
56 [AC_TRY_COMPILE([#include <stdlib.h> 81 [AC_COMPILE_IFELSE(
82 [AC_LANG_PROGRAM(
83 [[
84#undef _BSD
85#define _BSD 1 /* unhide unsetenv declaration in OSF/1 5.1 <stdlib.h> */
86#include <stdlib.h>
57extern 87extern
58#ifdef __cplusplus 88#ifdef __cplusplus
59"C" 89"C"
60#endif 90#endif
61#if defined(__STDC__) || defined(__cplusplus)
62int unsetenv (const char *name); 91int unsetenv (const char *name);
63#else 92 ]],
64int unsetenv(); 93 [[]])],
65#endif 94 [gt_cv_func_unsetenv_ret='int'],
66], , gt_cv_func_unsetenv_ret='int', gt_cv_func_unsetenv_ret='void')]) 95 [gt_cv_func_unsetenv_ret='void'])])
67 if test $gt_cv_func_unsetenv_ret = 'void'; then 96 if test $gt_cv_func_unsetenv_ret = 'void'; then
68 AC_DEFINE([VOID_UNSETENV], [1], [Define to 1 if unsetenv returns void 97 AC_DEFINE([VOID_UNSETENV], [1], [Define to 1 if unsetenv returns void
69 instead of int.]) 98 instead of int.])
70 REPLACE_UNSETENV=1 99 REPLACE_UNSETENV=1
71 AC_LIBOBJ([unsetenv])
72 fi 100 fi
73 101
74 dnl Solaris 10 unsetenv does not remove all copies of a name. 102 dnl Solaris 10 unsetenv does not remove all copies of a name.
75 AC_CACHE_CHECK([whether unsetenv works on duplicates], 103 dnl Haiku alpha 2 unsetenv gets confused by assignment to environ.
104 dnl OpenBSD 4.7 unsetenv("") does not fail.
105 AC_CACHE_CHECK([whether unsetenv obeys POSIX],
76 [gl_cv_func_unsetenv_works], 106 [gl_cv_func_unsetenv_works],
77 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ 107 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
78 #include <stdlib.h> 108 #include <stdlib.h>
109 #include <errno.h>
110 extern char **environ;
79 ]], [[ 111 ]], [[
80 char entry[] = "b=2"; 112 char entry1[] = "a=1";
113 char entry2[] = "b=2";
114 char *env[] = { entry1, entry2, NULL };
81 if (putenv ((char *) "a=1")) return 1; 115 if (putenv ((char *) "a=1")) return 1;
82 if (putenv (entry)) return 2; 116 if (putenv (entry2)) return 2;
83 entry[0] = 'a'; 117 entry2[0] = 'a';
84 unsetenv ("a"); 118 unsetenv ("a");
85 if (getenv ("a")) return 3; 119 if (getenv ("a")) return 3;
120 if (!unsetenv ("") || errno != EINVAL) return 4;
121 entry2[0] = 'b';
122 environ = env;
123 if (!getenv ("a")) return 5;
124 entry2[0] = 'a';
125 unsetenv ("a");
126 if (getenv ("a")) return 6;
86 ]])], 127 ]])],
87 [gl_cv_func_unsetenv_works=yes], [gl_cv_func_unsetenv_works=no], 128 [gl_cv_func_unsetenv_works=yes], [gl_cv_func_unsetenv_works=no],
88 [gl_cv_func_unsetenv_works="guessing no"])]) 129 [case "$host_os" in
89 if test "$gl_cv_func_unsetenv_works" != yes; then 130 # Guess yes on glibc systems.
90 REPLACE_UNSETENV=1 131 *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;;
91 AC_LIBOBJ([unsetenv]) 132 # If we don't know, assume the worst.
92 fi 133 *) gl_cv_func_unsetenv_works="guessing no" ;;
134 esac
135 ])])
136 case "$gl_cv_func_unsetenv_works" in
137 *yes) ;;
138 *)
139 REPLACE_UNSETENV=1
140 ;;
141 esac
93 fi 142 fi
94]) 143])
95 144
diff --git a/gl/m4/sha1.m4 b/gl/m4/sha1.m4
index 0d18d85..21c775e 100644
--- a/gl/m4/sha1.m4
+++ b/gl/m4/sha1.m4
@@ -1,16 +1,12 @@
1# sha1.m4 serial 9 1# sha1.m4 serial 11
2dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 Free Software 2dnl Copyright (C) 2002-2006, 2008-2013 Free Software Foundation, Inc.
3dnl Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
7 6
8AC_DEFUN([gl_SHA1], 7AC_DEFUN([gl_SHA1],
9[ 8[
10 AC_LIBOBJ([sha1])
11
12 dnl Prerequisites of lib/sha1.c. 9 dnl Prerequisites of lib/sha1.c.
13 AC_REQUIRE([gl_BIGENDIAN]) 10 AC_REQUIRE([gl_BIGENDIAN])
14 AC_REQUIRE([AC_C_INLINE])
15 : 11 :
16]) 12])
diff --git a/gl/m4/size_max.m4 b/gl/m4/size_max.m4
index ce992db..4b247ab 100644
--- a/gl/m4/size_max.m4
+++ b/gl/m4/size_max.m4
@@ -1,5 +1,5 @@
1# size_max.m4 serial 9 1# size_max.m4 serial 10
2dnl Copyright (C) 2003, 2005-2006, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2005-2006, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -34,10 +34,14 @@ Found it
34 if test $fits_in_uint = 1; then 34 if test $fits_in_uint = 1; then
35 dnl Even though SIZE_MAX fits in an unsigned int, it must be of type 35 dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
36 dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. 36 dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
37 AC_TRY_COMPILE([#include <stddef.h> 37 AC_COMPILE_IFELSE(
38 extern size_t foo; 38 [AC_LANG_PROGRAM(
39 extern unsigned long foo; 39 [[#include <stddef.h>
40 ], [], [fits_in_uint=0]) 40 extern size_t foo;
41 extern unsigned long foo;
42 ]],
43 [[]])],
44 [fits_in_uint=0])
41 fi 45 fi
42 dnl We cannot use 'expr' to simplify this expression, because 'expr' 46 dnl We cannot use 'expr' to simplify this expression, because 'expr'
43 dnl works only with 'long' integers in the host environment, while we 47 dnl works only with 'long' integers in the host environment, while we
diff --git a/gl/m4/snprintf.m4 b/gl/m4/snprintf.m4
index 522b107..3698e84 100644
--- a/gl/m4/snprintf.m4
+++ b/gl/m4/snprintf.m4
@@ -1,9 +1,13 @@
1# snprintf.m4 serial 5 1# snprintf.m4 serial 6
2dnl Copyright (C) 2002-2004, 2007-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2004, 2007-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7dnl Libintl 0.17 will replace snprintf only if it does not support %1$s,
8dnl but defers to any gnulib snprintf replacements. Therefore, gnulib
9dnl must guarantee that the decision for replacing snprintf is a superset
10dnl of the reasons checked by libintl.
7AC_DEFUN([gl_FUNC_SNPRINTF], 11AC_DEFUN([gl_FUNC_SNPRINTF],
8[ 12[
9 AC_REQUIRE([gl_STDIO_H_DEFAULTS]) 13 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
@@ -13,7 +17,17 @@ AC_DEFUN([gl_FUNC_SNPRINTF],
13 gl_SNPRINTF_SIZE1 17 gl_SNPRINTF_SIZE1
14 case "$gl_cv_func_snprintf_size1" in 18 case "$gl_cv_func_snprintf_size1" in
15 *yes) 19 *yes)
16 gl_cv_func_snprintf_usable=yes 20 gl_SNPRINTF_RETVAL_C99
21 case "$gl_cv_func_snprintf_retval_c99" in
22 *yes)
23 gl_PRINTF_POSITIONS
24 case "$gl_cv_func_printf_positions" in
25 *yes)
26 gl_cv_func_snprintf_usable=yes
27 ;;
28 esac
29 ;;
30 esac
17 ;; 31 ;;
18 esac 32 esac
19 fi 33 fi
diff --git a/gl/m4/socketlib.m4 b/gl/m4/socketlib.m4
new file mode 100644
index 0000000..b08a72f
--- /dev/null
+++ b/gl/m4/socketlib.m4
@@ -0,0 +1,86 @@
1# socketlib.m4 serial 1
2dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl gl_SOCKETLIB
8dnl Determines the library to use for socket functions.
9dnl Sets and AC_SUBSTs LIBSOCKET.
10
11AC_DEFUN([gl_SOCKETLIB],
12[
13 gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H
14 LIBSOCKET=
15 if test $HAVE_WINSOCK2_H = 1; then
16 dnl Native Windows API (not Cygwin).
17 AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32],
18 [gl_cv_func_wsastartup], [
19 gl_save_LIBS="$LIBS"
20 LIBS="$LIBS -lws2_32"
21 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
22#ifdef HAVE_WINSOCK2_H
23# include <winsock2.h>
24#endif]], [[
25 WORD wVersionRequested = MAKEWORD(1, 1);
26 WSADATA wsaData;
27 int err = WSAStartup(wVersionRequested, &wsaData);
28 WSACleanup ();]])],
29 gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no)
30 LIBS="$gl_save_LIBS"
31 ])
32 if test "$gl_cv_func_wsastartup" = "yes"; then
33 AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.])
34 LIBSOCKET='-lws2_32'
35 fi
36 else
37 dnl Unix API.
38 dnl Solaris has most socket functions in libsocket.
39 dnl Haiku has most socket functions in libnetwork.
40 dnl BeOS has most socket functions in libnet.
41 AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [
42 gl_cv_lib_socket=
43 AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
44#ifdef __cplusplus
45"C"
46#endif
47char setsockopt();]], [[setsockopt();]])],
48 [],
49 [gl_save_LIBS="$LIBS"
50 LIBS="$gl_save_LIBS -lsocket"
51 AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
52#ifdef __cplusplus
53"C"
54#endif
55char setsockopt();]], [[setsockopt();]])],
56 [gl_cv_lib_socket="-lsocket"])
57 if test -z "$gl_cv_lib_socket"; then
58 LIBS="$gl_save_LIBS -lnetwork"
59 AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
60#ifdef __cplusplus
61"C"
62#endif
63char setsockopt();]], [[setsockopt();]])],
64 [gl_cv_lib_socket="-lnetwork"])
65 if test -z "$gl_cv_lib_socket"; then
66 LIBS="$gl_save_LIBS -lnet"
67 AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
68#ifdef __cplusplus
69"C"
70#endif
71char setsockopt();]], [[setsockopt();]])],
72 [gl_cv_lib_socket="-lnet"])
73 fi
74 fi
75 LIBS="$gl_save_LIBS"
76 ])
77 if test -z "$gl_cv_lib_socket"; then
78 gl_cv_lib_socket="none needed"
79 fi
80 ])
81 if test "$gl_cv_lib_socket" != "none needed"; then
82 LIBSOCKET="$gl_cv_lib_socket"
83 fi
84 fi
85 AC_SUBST([LIBSOCKET])
86])
diff --git a/gl/m4/sockets.m4 b/gl/m4/sockets.m4
index aefb936..b407391 100644
--- a/gl/m4/sockets.m4
+++ b/gl/m4/sockets.m4
@@ -1,5 +1,5 @@
1# sockets.m4 serial 6 1# sockets.m4 serial 7
2dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -7,80 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
7AC_DEFUN([gl_SOCKETS], 7AC_DEFUN([gl_SOCKETS],
8[ 8[
9 AC_REQUIRE([AC_C_INLINE]) 9 AC_REQUIRE([AC_C_INLINE])
10 10 AC_REQUIRE([gl_SOCKETLIB])
11 gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H
12 LIBSOCKET=
13 if test $HAVE_WINSOCK2_H = 1; then
14 dnl Native Windows API (not Cygwin).
15 AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32],
16 [gl_cv_func_wsastartup], [
17 gl_save_LIBS="$LIBS"
18 LIBS="$LIBS -lws2_32"
19 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
20#ifdef HAVE_WINSOCK2_H
21# include <winsock2.h>
22#endif]], [[
23 WORD wVersionRequested = MAKEWORD(1, 1);
24 WSADATA wsaData;
25 int err = WSAStartup(wVersionRequested, &wsaData);
26 WSACleanup ();]])],
27 gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no)
28 LIBS="$gl_save_LIBS"
29 ])
30 if test "$gl_cv_func_wsastartup" = "yes"; then
31 AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.])
32 LIBSOCKET='-lws2_32'
33 fi
34 else
35 dnl Unix API.
36 dnl Solaris has most socket functions in libsocket.
37 dnl Haiku has most socket functions in libnetwork.
38 dnl BeOS has most socket functions in libnet.
39 AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [
40 gl_cv_lib_socket=
41 AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
42#ifdef __cplusplus
43"C"
44#endif
45char setsockopt();]], [[setsockopt();]])],
46 [],
47 [gl_save_LIBS="$LIBS"
48 LIBS="$gl_save_LIBS -lsocket"
49 AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
50#ifdef __cplusplus
51"C"
52#endif
53char setsockopt();]], [[setsockopt();]])],
54 [gl_cv_lib_socket="-lsocket"])
55 if test -z "$gl_cv_lib_socket"; then
56 LIBS="$gl_save_LIBS -lnetwork"
57 AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
58#ifdef __cplusplus
59"C"
60#endif
61char setsockopt();]], [[setsockopt();]])],
62 [gl_cv_lib_socket="-lnetwork"])
63 if test -z "$gl_cv_lib_socket"; then
64 LIBS="$gl_save_LIBS -lnet"
65 AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
66#ifdef __cplusplus
67"C"
68#endif
69char setsockopt();]], [[setsockopt();]])],
70 [gl_cv_lib_socket="-lnet"])
71 fi
72 fi
73 LIBS="$gl_save_LIBS"
74 ])
75 if test -z "$gl_cv_lib_socket"; then
76 gl_cv_lib_socket="none needed"
77 fi
78 ])
79 if test "$gl_cv_lib_socket" != "none needed"; then
80 LIBSOCKET="$gl_cv_lib_socket"
81 fi
82 fi
83 AC_SUBST([LIBSOCKET])
84 gl_PREREQ_SOCKETS 11 gl_PREREQ_SOCKETS
85]) 12])
86 13
diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4
index 2933d4b..e3efd6e 100644
--- a/gl/m4/socklen.m4
+++ b/gl/m4/socklen.m4
@@ -1,5 +1,5 @@
1# socklen.m4 serial 7 1# socklen.m4 serial 10
2dnl Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -8,15 +8,12 @@ dnl From Albert Chin, Windows fixes from Simon Josefsson.
8 8
9dnl Check for socklen_t: historically on BSD it is an int, and in 9dnl Check for socklen_t: historically on BSD it is an int, and in
10dnl POSIX 1g it is a type of its own, but some platforms use different 10dnl POSIX 1g it is a type of its own, but some platforms use different
11dnl types for the argument to getsockopt, getpeername, etc. So we 11dnl types for the argument to getsockopt, getpeername, etc.:
12dnl have to test to find something that will work. 12dnl HP-UX 10.20, IRIX 6.5, OSF/1 4.0, Interix 3.5, BeOS.
13dnl So we have to test to find something that will work.
13 14
14dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
15dnl it there first. That file is included by gnulib's sys_socket.in.h, which
16dnl all users of this module should include. Cygwin must not include
17dnl ws2tcpip.h.
18AC_DEFUN([gl_TYPE_SOCKLEN_T], 15AC_DEFUN([gl_TYPE_SOCKLEN_T],
19 [AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl 16 [AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])dnl
20 AC_CHECK_TYPE([socklen_t], , 17 AC_CHECK_TYPE([socklen_t], ,
21 [AC_MSG_CHECKING([for socklen_t equivalent]) 18 [AC_MSG_CHECKING([for socklen_t equivalent])
22 AC_CACHE_VAL([gl_cv_socklen_t_equiv], 19 AC_CACHE_VAL([gl_cv_socklen_t_equiv],
@@ -44,9 +41,37 @@ AC_DEFUN([gl_TYPE_SOCKLEN_T],
44 AC_MSG_RESULT([$gl_cv_socklen_t_equiv]) 41 AC_MSG_RESULT([$gl_cv_socklen_t_equiv])
45 AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv], 42 AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
46 [type to use in place of socklen_t if not defined])], 43 [type to use in place of socklen_t if not defined])],
47 [#include <sys/types.h> 44 [gl_SOCKET_HEADERS])])
48 #if HAVE_SYS_SOCKET_H 45
49 # include <sys/socket.h> 46dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
50 #elif HAVE_WS2TCPIP_H 47dnl it there too. But on Cygwin, wc2tcpip.h must not be included. Users
51 # include <ws2tcpip.h> 48dnl of this module should use the same include pattern as gl_SOCKET_HEADERS.
52 #endif])]) 49dnl When you change this macro, keep also in sync:
50dnl - gl_CHECK_SOCKET_HEADERS,
51dnl - the Include section of modules/socklen.
52AC_DEFUN([gl_SOCKET_HEADERS],
53[
54/* <sys/types.h> is not needed according to POSIX, but the
55 <sys/socket.h> in i386-unknown-freebsd4.10 and
56 powerpc-apple-darwin5.5 required it. */
57#include <sys/types.h>
58#if HAVE_SYS_SOCKET_H
59# include <sys/socket.h>
60#elif HAVE_WS2TCPIP_H
61# include <ws2tcpip.h>
62#endif
63])
64
65dnl Tests for the existence of the header for socket facilities.
66dnl Defines the C macros HAVE_SYS_SOCKET_H, HAVE_WS2TCPIP_H.
67dnl This macro must match gl_SOCKET_HEADERS.
68AC_DEFUN([gl_CHECK_SOCKET_HEADERS],
69 [AC_CHECK_HEADERS_ONCE([sys/socket.h])
70 if test $ac_cv_header_sys_socket_h = no; then
71 dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
72 dnl the check for those headers unconditional; yet cygwin reports
73 dnl that the headers are present but cannot be compiled (since on
74 dnl cygwin, all socket information should come from sys/socket.h).
75 AC_CHECK_HEADERS([ws2tcpip.h])
76 fi
77 ])
diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4
index 8806705..89557b1 100644
--- a/gl/m4/sockpfaf.m4
+++ b/gl/m4/sockpfaf.m4
@@ -1,5 +1,5 @@
1# sockpfaf.m4 serial 7 1# sockpfaf.m4 serial 8
2dnl Copyright (C) 2004, 2006, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2004, 2006, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -59,3 +59,29 @@ AC_DEFUN([gl_SOCKET_FAMILIES],
59 AC_DEFINE([HAVE_IPV6], [1], [Define to 1 if <sys/socket.h> defines AF_INET6.]) 59 AC_DEFINE([HAVE_IPV6], [1], [Define to 1 if <sys/socket.h> defines AF_INET6.])
60 fi 60 fi
61]) 61])
62
63AC_DEFUN([gl_SOCKET_FAMILY_UNIX],
64[
65 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
66 AC_CHECK_HEADERS_ONCE([sys/un.h])
67
68 AC_MSG_CHECKING([for UNIX domain sockets])
69 AC_CACHE_VAL([gl_cv_socket_unix],
70 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
71#ifdef HAVE_SYS_SOCKET_H
72#include <sys/socket.h>
73#endif
74#ifdef HAVE_SYS_UN_H
75#include <sys/un.h>
76#endif
77#ifdef HAVE_WINSOCK2_H
78#include <winsock2.h>
79#endif]],
80[[int x = AF_UNIX; struct sockaddr_un y;
81 if (&x && &y) return 0;]])],
82 gl_cv_socket_unix=yes, gl_cv_socket_unix=no)])
83 AC_MSG_RESULT([$gl_cv_socket_unix])
84 if test $gl_cv_socket_unix = yes; then
85 AC_DEFINE([HAVE_UNIXSOCKET], [1], [Define to 1 if <sys/socket.h> defines AF_UNIX.])
86 fi
87])
diff --git a/gl/m4/ssize_t.m4 b/gl/m4/ssize_t.m4
index e0ccee3..6338134 100644
--- a/gl/m4/ssize_t.m4
+++ b/gl/m4/ssize_t.m4
@@ -1,5 +1,5 @@
1# ssize_t.m4 serial 4 (gettext-0.15) 1# ssize_t.m4 serial 5 (gettext-0.18.2)
2dnl Copyright (C) 2001-2003, 2006, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2003, 2006, 2010-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -10,9 +10,11 @@ dnl Test whether ssize_t is defined.
10AC_DEFUN([gt_TYPE_SSIZE_T], 10AC_DEFUN([gt_TYPE_SSIZE_T],
11[ 11[
12 AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t], 12 AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t],
13 [AC_TRY_COMPILE([#include <sys/types.h>], 13 [AC_COMPILE_IFELSE(
14 [int x = sizeof (ssize_t *) + sizeof (ssize_t); 14 [AC_LANG_PROGRAM(
15 return !x;], 15 [[#include <sys/types.h>]],
16 [[int x = sizeof (ssize_t *) + sizeof (ssize_t);
17 return !x;]])],
16 [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])]) 18 [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])])
17 if test $gt_cv_ssize_t = no; then 19 if test $gt_cv_ssize_t = no; then
18 AC_DEFINE([ssize_t], [int], 20 AC_DEFINE([ssize_t], [int],
diff --git a/gl/m4/stat.m4 b/gl/m4/stat.m4
deleted file mode 100644
index acd32d8..0000000
--- a/gl/m4/stat.m4
+++ /dev/null
@@ -1,63 +0,0 @@
1# serial 4
2
3# Copyright (C) 2009, 2010 Free Software Foundation, Inc.
4#
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9AC_DEFUN([gl_FUNC_STAT],
10[
11 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
12 AC_REQUIRE([gl_AC_DOS])
13 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
14 AC_CHECK_FUNCS_ONCE([lstat])
15 dnl mingw is the only known platform where stat(".") and stat("./") differ
16 AC_CACHE_CHECK([whether stat handles trailing slashes on directories],
17 [gl_cv_func_stat_dir_slash],
18 [AC_RUN_IFELSE(
19 [AC_LANG_PROGRAM(
20 [[#include <sys/stat.h>
21]], [[struct stat st; return stat (".", &st) != stat ("./", &st);]])],
22 [gl_cv_func_stat_dir_slash=yes], [gl_cv_func_stat_dir_slash=no],
23 [case $host_os in
24 mingw*) gl_cv_func_stat_dir_slash="guessing no";;
25 *) gl_cv_func_stat_dir_slash="guessing yes";;
26 esac])])
27 dnl Solaris 9 mistakenly succeeds on stat("file/")
28 dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/")
29 AC_CACHE_CHECK([whether stat handles trailing slashes on files],
30 [gl_cv_func_stat_file_slash],
31 [touch conftest.tmp
32 # Assume that if we have lstat, we can also check symlinks.
33 if test $ac_cv_func_lstat = yes; then
34 ln -s conftest.tmp conftest.lnk
35 fi
36 AC_RUN_IFELSE(
37 [AC_LANG_PROGRAM(
38 [[#include <sys/stat.h>
39]], [[struct stat st;
40 if (!stat ("conftest.tmp/", &st)) return 1;
41#if HAVE_LSTAT
42 if (!stat ("conftest.lnk/", &st)) return 2;
43#endif
44 ]])],
45 [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no],
46 [gl_cv_func_stat_file_slash="guessing no"])
47 rm -f conftest.tmp conftest.lnk])
48 case $gl_cv_func_stat_dir_slash in
49 *no) REPLACE_STAT=1
50 AC_DEFINE([REPLACE_FUNC_STAT_DIR], [1], [Define to 1 if stat needs
51 help when passed a directory name with a trailing slash]);;
52 esac
53 case $gl_cv_func_stat_file_slash in
54 *no) REPLACE_STAT=1
55 AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs
56 help when passed a file name with a trailing slash]);;
57 esac
58 if test $REPLACE_STAT = 1; then
59 AC_LIBOBJ([stat])
60 dnl Prerequisites of lib/stat.c.
61 AC_REQUIRE([AC_C_INLINE])
62 fi
63])
diff --git a/gl/m4/stdalign.m4 b/gl/m4/stdalign.m4
new file mode 100644
index 0000000..20be01a
--- /dev/null
+++ b/gl/m4/stdalign.m4
@@ -0,0 +1,53 @@
1# Check for stdalign.h that conforms to C11.
2
3dnl Copyright 2011-2013 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8# Prepare for substituting <stdalign.h> if it is not supported.
9
10AC_DEFUN([gl_STDALIGN_H],
11[
12 AC_CACHE_CHECK([for working stdalign.h],
13 [gl_cv_header_working_stdalign_h],
14 [AC_COMPILE_IFELSE(
15 [AC_LANG_PROGRAM(
16 [[#include <stdalign.h>
17 #include <stddef.h>
18
19 /* Test that alignof yields a result consistent with offsetof.
20 This catches GCC bug 52023
21 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */
22 #ifdef __cplusplus
23 template <class t> struct alignof_helper { char a; t b; };
24 # define ao(type) offsetof (alignof_helper<type>, b)
25 #else
26 # define ao(type) offsetof (struct { char a; type b; }, b)
27 #endif
28 char test_double[ao (double) % _Alignof (double) == 0 ? 1 : -1];
29 char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1];
30 char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1];
31
32 /* Test _Alignas only on platforms where gnulib can help. */
33 #if \
34 ((defined __cplusplus && 201103 <= __cplusplus) \
35 || __GNUC__ || __IBMC__ || __IBMCPP__ || __ICC \
36 || 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER)
37 struct alignas_test { char c; char alignas (8) alignas_8; };
38 char test_alignas[offsetof (struct alignas_test, alignas_8) == 8
39 ? 1 : -1];
40 #endif
41 ]])],
42 [gl_cv_header_working_stdalign_h=yes],
43 [gl_cv_header_working_stdalign_h=no])])
44
45 if test $gl_cv_header_working_stdalign_h = yes; then
46 STDALIGN_H=''
47 else
48 STDALIGN_H='stdalign.h'
49 fi
50
51 AC_SUBST([STDALIGN_H])
52 AM_CONDITIONAL([GL_GENERATE_STDALIGN_H], [test -n "$STDALIGN_H"])
53])
diff --git a/gl/m4/stdbool.m4 b/gl/m4/stdbool.m4
index 3d672d7..80d5559 100644
--- a/gl/m4/stdbool.m4
+++ b/gl/m4/stdbool.m4
@@ -1,15 +1,17 @@
1# Check for stdbool.h that conforms to C99. 1# Check for stdbool.h that conforms to C99.
2 2
3dnl Copyright (C) 2002-2006, 2009-2010 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7 7
8#serial 5
9
8# Prepare for substituting <stdbool.h> if it is not supported. 10# Prepare for substituting <stdbool.h> if it is not supported.
9 11
10AC_DEFUN([AM_STDBOOL_H], 12AC_DEFUN([AM_STDBOOL_H],
11[ 13[
12 AC_REQUIRE([AC_HEADER_STDBOOL]) 14 AC_REQUIRE([AC_CHECK_HEADER_STDBOOL])
13 15
14 # Define two additional variables used in the Makefile substitution. 16 # Define two additional variables used in the Makefile substitution.
15 17
@@ -19,6 +21,7 @@ AC_DEFUN([AM_STDBOOL_H],
19 STDBOOL_H='stdbool.h' 21 STDBOOL_H='stdbool.h'
20 fi 22 fi
21 AC_SUBST([STDBOOL_H]) 23 AC_SUBST([STDBOOL_H])
24 AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"])
22 25
23 if test "$ac_cv_type__Bool" = yes; then 26 if test "$ac_cv_type__Bool" = yes; then
24 HAVE__BOOL=1 27 HAVE__BOOL=1
@@ -31,85 +34,67 @@ AC_DEFUN([AM_STDBOOL_H],
31# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. 34# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future.
32AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) 35AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H])
33 36
34# This macro is only needed in autoconf <= 2.59. Newer versions of autoconf 37# This version of the macro is needed in autoconf <= 2.68.
35# have this macro built-in.
36 38
37AC_DEFUN([AC_HEADER_STDBOOL], 39AC_DEFUN([AC_CHECK_HEADER_STDBOOL],
38 [AC_CACHE_CHECK([for stdbool.h that conforms to C99], 40 [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
39 [ac_cv_header_stdbool_h], 41 [ac_cv_header_stdbool_h],
40 [AC_TRY_COMPILE( 42 [AC_COMPILE_IFELSE(
41 [ 43 [AC_LANG_PROGRAM(
42 #include <stdbool.h> 44 [[
43 #ifndef bool 45 #include <stdbool.h>
44 "error: bool is not defined" 46 #ifndef bool
45 #endif 47 "error: bool is not defined"
46 #ifndef false 48 #endif
47 "error: false is not defined" 49 #ifndef false
48 #endif 50 "error: false is not defined"
49 #if false 51 #endif
50 "error: false is not 0" 52 #if false
51 #endif 53 "error: false is not 0"
52 #ifndef true 54 #endif
53 "error: true is not defined" 55 #ifndef true
54 #endif 56 "error: true is not defined"
55 #if true != 1 57 #endif
56 "error: true is not 1" 58 #if true != 1
57 #endif 59 "error: true is not 1"
58 #ifndef __bool_true_false_are_defined 60 #endif
59 "error: __bool_true_false_are_defined is not defined" 61 #ifndef __bool_true_false_are_defined
60 #endif 62 "error: __bool_true_false_are_defined is not defined"
63 #endif
61 64
62 struct s { _Bool s: 1; _Bool t; } s; 65 struct s { _Bool s: 1; _Bool t; } s;
63 66
64 char a[true == 1 ? 1 : -1]; 67 char a[true == 1 ? 1 : -1];
65 char b[false == 0 ? 1 : -1]; 68 char b[false == 0 ? 1 : -1];
66 char c[__bool_true_false_are_defined == 1 ? 1 : -1]; 69 char c[__bool_true_false_are_defined == 1 ? 1 : -1];
67 char d[(bool) 0.5 == true ? 1 : -1]; 70 char d[(bool) 0.5 == true ? 1 : -1];
68 bool e = &s; 71 /* See body of main program for 'e'. */
69 char f[(_Bool) 0.0 == false ? 1 : -1]; 72 char f[(_Bool) 0.0 == false ? 1 : -1];
70 char g[true]; 73 char g[true];
71 char h[sizeof (_Bool)]; 74 char h[sizeof (_Bool)];
72 char i[sizeof s.t]; 75 char i[sizeof s.t];
73 enum { j = false, k = true, l = false * true, m = true * 256 }; 76 enum { j = false, k = true, l = false * true, m = true * 256 };
74 _Bool n[m]; 77 /* The following fails for
75 char o[sizeof n == m * sizeof n[0] ? 1 : -1]; 78 HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
76 char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; 79 _Bool n[m];
77 #if defined __xlc__ || defined __GNUC__ 80 char o[sizeof n == m * sizeof n[0] ? 1 : -1];
78 /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 81 char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
79 reported by James Lemley on 2005-10-05; see 82 /* Catch a bug in an HP-UX C compiler. See
80 http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html 83 http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
81 This test is not quite right, since xlc is allowed to 84 http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
82 reject this program, as the initializer for xlcbug is 85 */
83 not one of the forms that C requires support for. 86 _Bool q = true;
84 However, doing the test right would require a run-time 87 _Bool *pq = &q;
85 test, and that would make cross-compilation harder. 88 ]],
86 Let us hope that IBM fixes the xlc bug, and also adds 89 [[
87 support for this kind of constant expression. In the 90 bool e = &s;
88 meantime, this test will reject xlc, which is OK, since 91 *pq |= q;
89 our stdbool.h substitute should suffice. We also test 92 *pq |= ! q;
90 this with GCC, where it should work, to detect more 93 /* Refer to every declared value, to avoid compiler optimizations. */
91 quickly whether someone messes up the test in the 94 return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
92 future. */ 95 + !m + !n + !o + !p + !q + !pq);
93 char digs[] = "0123456789"; 96 ]])],
94 int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
95 #endif
96 /* Catch a bug in an HP-UX C compiler. See
97 http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
98 http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
99 */
100 _Bool q = true;
101 _Bool *pq = &q;
102 ],
103 [
104 *pq |= q;
105 *pq |= ! q;
106 /* Refer to every declared value, to avoid compiler optimizations. */
107 return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
108 + !m + !n + !o + !p + !q + !pq);
109 ],
110 [ac_cv_header_stdbool_h=yes], 97 [ac_cv_header_stdbool_h=yes],
111 [ac_cv_header_stdbool_h=no])]) 98 [ac_cv_header_stdbool_h=no])])
112 AC_CHECK_TYPES([_Bool]) 99 AC_CHECK_TYPES([_Bool])
113 if test $ac_cv_header_stdbool_h = yes; then 100])
114 AC_DEFINE([HAVE_STDBOOL_H], [1], [Define to 1 if stdbool.h conforms to C99.])
115 fi])
diff --git a/gl/m4/stddef_h.m4 b/gl/m4/stddef_h.m4
index c3ae569..5da8ab1 100644
--- a/gl/m4/stddef_h.m4
+++ b/gl/m4/stddef_h.m4
@@ -1,6 +1,6 @@
1dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues. 1dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues.
2# stddef_h.m4 serial 2 2# stddef_h.m4 serial 4
3dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2013 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
@@ -9,6 +9,7 @@ AC_DEFUN([gl_STDDEF_H],
9[ 9[
10 AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) 10 AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
11 AC_REQUIRE([gt_TYPE_WCHAR_T]) 11 AC_REQUIRE([gt_TYPE_WCHAR_T])
12 STDDEF_H=
12 if test $gt_cv_c_wchar_t = no; then 13 if test $gt_cv_c_wchar_t = no; then
13 HAVE_WCHAR_T=0 14 HAVE_WCHAR_T=0
14 STDDEF_H=stddef.h 15 STDDEF_H=stddef.h
@@ -24,8 +25,10 @@ AC_DEFUN([gl_STDDEF_H],
24 REPLACE_NULL=1 25 REPLACE_NULL=1
25 STDDEF_H=stddef.h 26 STDDEF_H=stddef.h
26 fi 27 fi
28 AC_SUBST([STDDEF_H])
29 AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"])
27 if test -n "$STDDEF_H"; then 30 if test -n "$STDDEF_H"; then
28 gl_CHECK_NEXT_HEADERS([stddef.h]) 31 gl_NEXT_HEADERS([stddef.h])
29 fi 32 fi
30]) 33])
31 34
@@ -41,5 +44,4 @@ AC_DEFUN([gl_STDDEF_H_DEFAULTS],
41 dnl Assume proper GNU behavior unless another module says otherwise. 44 dnl Assume proper GNU behavior unless another module says otherwise.
42 REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) 45 REPLACE_NULL=0; AC_SUBST([REPLACE_NULL])
43 HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) 46 HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T])
44 STDDEF_H=''; AC_SUBST([STDDEF_H])
45]) 47])
diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4
index c5e813a..27cdcdb 100644
--- a/gl/m4/stdint.m4
+++ b/gl/m4/stdint.m4
@@ -1,5 +1,5 @@
1# stdint.m4 serial 35 1# stdint.m4 serial 43
2dnl Copyright (C) 2001-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
7dnl From Paul Eggert and Bruno Haible. 7dnl From Paul Eggert and Bruno Haible.
8dnl Test whether <stdint.h> is supported or must be substituted. 8dnl Test whether <stdint.h> is supported or must be substituted.
9 9
10AC_DEFUN([gl_STDINT_H], 10AC_DEFUN_ONCE([gl_STDINT_H],
11[ 11[
12 AC_PREREQ([2.59])dnl 12 AC_PREREQ([2.59])dnl
13 13
@@ -27,6 +27,15 @@ AC_DEFUN([gl_STDINT_H],
27 fi 27 fi
28 AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT]) 28 AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT])
29 29
30 dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does.
31 AC_CHECK_HEADERS_ONCE([wchar.h])
32 if test $ac_cv_header_wchar_h = yes; then
33 HAVE_WCHAR_H=1
34 else
35 HAVE_WCHAR_H=0
36 fi
37 AC_SUBST([HAVE_WCHAR_H])
38
30 dnl Check for <inttypes.h>. 39 dnl Check for <inttypes.h>.
31 dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h. 40 dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
32 if test $ac_cv_header_inttypes_h = yes; then 41 if test $ac_cv_header_inttypes_h = yes; then
@@ -60,8 +69,6 @@ AC_DEFUN([gl_STDINT_H],
60 [gl_cv_header_working_stdint_h=no 69 [gl_cv_header_working_stdint_h=no
61 AC_COMPILE_IFELSE([ 70 AC_COMPILE_IFELSE([
62 AC_LANG_PROGRAM([[ 71 AC_LANG_PROGRAM([[
63#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
64#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
65#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ 72#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
66#include <stdint.h> 73#include <stdint.h>
67/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */ 74/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */
@@ -145,9 +152,11 @@ uintmax_t j = UINTMAX_MAX;
145 152
146#include <limits.h> /* for CHAR_BIT */ 153#include <limits.h> /* for CHAR_BIT */
147#define TYPE_MINIMUM(t) \ 154#define TYPE_MINIMUM(t) \
148 ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) 155 ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t)))
149#define TYPE_MAXIMUM(t) \ 156#define TYPE_MAXIMUM(t) \
150 ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) 157 ((t) ((t) 0 < (t) -1 \
158 ? (t) -1 \
159 : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
151struct s { 160struct s {
152 int check_PTRDIFF: 161 int check_PTRDIFF:
153 PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) 162 PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t)
@@ -208,8 +217,6 @@ struct s {
208 dnl This detects a bug on HP-UX 11.23/ia64. 217 dnl This detects a bug on HP-UX 11.23/ia64.
209 AC_RUN_IFELSE([ 218 AC_RUN_IFELSE([
210 AC_LANG_PROGRAM([[ 219 AC_LANG_PROGRAM([[
211#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
212#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
213#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ 220#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
214#include <stdint.h> 221#include <stdint.h>
215] 222]
@@ -259,7 +266,7 @@ static const char *macro_values[] =
259 || strncmp (value, "((int)"/*)*/, 6) == 0 266 || strncmp (value, "((int)"/*)*/, 6) == 0
260 || strncmp (value, "((signed short)"/*)*/, 15) == 0 267 || strncmp (value, "((signed short)"/*)*/, 15) == 0
261 || strncmp (value, "((signed char)"/*)*/, 14) == 0) 268 || strncmp (value, "((signed char)"/*)*/, 14) == 0)
262 return 1; 269 return mv - macro_values + 1;
263 } 270 }
264 return 0; 271 return 0;
265]])], 272]])],
@@ -290,14 +297,11 @@ static const char *macro_values[] =
290 fi 297 fi
291 AC_SUBST([HAVE_SYS_BITYPES_H]) 298 AC_SUBST([HAVE_SYS_BITYPES_H])
292 299
293 dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
294 dnl character support).
295 AC_CHECK_HEADERS_ONCE([wchar.h])
296
297 gl_STDINT_TYPE_PROPERTIES 300 gl_STDINT_TYPE_PROPERTIES
298 STDINT_H=stdint.h 301 STDINT_H=stdint.h
299 fi 302 fi
300 AC_SUBST([STDINT_H]) 303 AC_SUBST([STDINT_H])
304 AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"])
301]) 305])
302 306
303dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) 307dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
@@ -458,6 +462,14 @@ AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
458 fi 462 fi
459 gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t], 463 gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t],
460 [gl_STDINT_INCLUDES]) 464 [gl_STDINT_INCLUDES])
465
466 dnl If wint_t is smaller than 'int', it cannot satisfy the ISO C 99
467 dnl requirement that wint_t is "unchanged by default argument promotions".
468 dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t.
469 dnl Set the variable BITSIZEOF_WINT_T accordingly.
470 if test $BITSIZEOF_WINT_T -lt 32; then
471 BITSIZEOF_WINT_T=32
472 fi
461]) 473])
462 474
463dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. 475dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
diff --git a/gl/m4/stdint_h.m4 b/gl/m4/stdint_h.m4
index b8e3c6c..511ab4e 100644
--- a/gl/m4/stdint_h.m4
+++ b/gl/m4/stdint_h.m4
@@ -1,5 +1,5 @@
1# stdint_h.m4 serial 8 1# stdint_h.m4 serial 9
2dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2004, 2006, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -12,12 +12,13 @@ dnl From Paul Eggert.
12AC_DEFUN([gl_AC_HEADER_STDINT_H], 12AC_DEFUN([gl_AC_HEADER_STDINT_H],
13[ 13[
14 AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h], 14 AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h],
15 [AC_TRY_COMPILE( 15 [AC_COMPILE_IFELSE(
16 [#include <sys/types.h> 16 [AC_LANG_PROGRAM(
17#include <stdint.h>], 17 [[#include <sys/types.h>
18 [uintmax_t i = (uintmax_t) -1; return !i;], 18 #include <stdint.h>]],
19 [gl_cv_header_stdint_h=yes], 19 [[uintmax_t i = (uintmax_t) -1; return !i;]])],
20 [gl_cv_header_stdint_h=no])]) 20 [gl_cv_header_stdint_h=yes],
21 [gl_cv_header_stdint_h=no])])
21 if test $gl_cv_header_stdint_h = yes; then 22 if test $gl_cv_header_stdint_h = yes; then
22 AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1], 23 AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1],
23 [Define if <stdint.h> exists, doesn't clash with <sys/types.h>, 24 [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4
index f5650cd..ebade06 100644
--- a/gl/m4/stdio_h.m4
+++ b/gl/m4/stdio_h.m4
@@ -1,5 +1,5 @@
1# stdio_h.m4 serial 31 1# stdio_h.m4 serial 43
2dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -7,9 +7,32 @@ dnl with or without modifications, as long as this notice is preserved.
7AC_DEFUN([gl_STDIO_H], 7AC_DEFUN([gl_STDIO_H],
8[ 8[
9 AC_REQUIRE([gl_STDIO_H_DEFAULTS]) 9 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
10 AC_REQUIRE([AC_C_INLINE]) 10 gl_NEXT_HEADERS([stdio.h])
11 AC_REQUIRE([gl_ASM_SYMBOL_PREFIX]) 11
12 gl_CHECK_NEXT_HEADERS([stdio.h]) 12 dnl No need to create extra modules for these functions. Everyone who uses
13 dnl <stdio.h> likely needs them.
14 GNULIB_FSCANF=1
15 gl_MODULE_INDICATOR([fscanf])
16 GNULIB_SCANF=1
17 gl_MODULE_INDICATOR([scanf])
18 GNULIB_FGETC=1
19 GNULIB_GETC=1
20 GNULIB_GETCHAR=1
21 GNULIB_FGETS=1
22 GNULIB_FREAD=1
23 dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c"
24 dnl "expected source file, required through AC_LIBSOURCES, not found". It is
25 dnl also an optimization, to avoid performing a configure check whose result
26 dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING
27 dnl or GNULIB_NONBLOCKING redundant.
28 m4_ifdef([gl_NONBLOCKING_IO], [
29 gl_NONBLOCKING_IO
30 if test $gl_cv_have_nonblocking != yes; then
31 REPLACE_STDIO_READ_FUNCS=1
32 AC_LIBOBJ([stdio-read])
33 fi
34 ])
35
13 dnl No need to create extra modules for these functions. Everyone who uses 36 dnl No need to create extra modules for these functions. Everyone who uses
14 dnl <stdio.h> likely needs them. 37 dnl <stdio.h> likely needs them.
15 GNULIB_FPRINTF=1 38 GNULIB_FPRINTF=1
@@ -22,9 +45,11 @@ AC_DEFUN([gl_STDIO_H],
22 GNULIB_FPUTS=1 45 GNULIB_FPUTS=1
23 GNULIB_PUTS=1 46 GNULIB_PUTS=1
24 GNULIB_FWRITE=1 47 GNULIB_FWRITE=1
25 dnl This ifdef is just an optimization, to avoid performing a configure 48 dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c"
26 dnl check whose result is not used. It does not make the test of 49 dnl "expected source file, required through AC_LIBSOURCES, not found". It is
27 dnl GNULIB_STDIO_H_SIGPIPE or GNULIB_SIGPIPE redundant. 50 dnl also an optimization, to avoid performing a configure check whose result
51 dnl is not used. But it does not make the test of GNULIB_STDIO_H_SIGPIPE or
52 dnl GNULIB_SIGPIPE redundant.
28 m4_ifdef([gl_SIGNAL_SIGPIPE], [ 53 m4_ifdef([gl_SIGNAL_SIGPIPE], [
29 gl_SIGNAL_SIGPIPE 54 gl_SIGNAL_SIGPIPE
30 if test $gl_cv_header_signal_h_SIGPIPE != yes; then 55 if test $gl_cv_header_signal_h_SIGPIPE != yes; then
@@ -32,13 +57,25 @@ AC_DEFUN([gl_STDIO_H],
32 AC_LIBOBJ([stdio-write]) 57 AC_LIBOBJ([stdio-write])
33 fi 58 fi
34 ]) 59 ])
60 dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c"
61 dnl "expected source file, required through AC_LIBSOURCES, not found". It is
62 dnl also an optimization, to avoid performing a configure check whose result
63 dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING
64 dnl or GNULIB_NONBLOCKING redundant.
65 m4_ifdef([gl_NONBLOCKING_IO], [
66 gl_NONBLOCKING_IO
67 if test $gl_cv_have_nonblocking != yes; then
68 REPLACE_STDIO_WRITE_FUNCS=1
69 AC_LIBOBJ([stdio-write])
70 fi
71 ])
35 72
36 dnl Check for declarations of anything we want to poison if the 73 dnl Check for declarations of anything we want to poison if the
37 dnl corresponding gnulib module is not in use, and which is not 74 dnl corresponding gnulib module is not in use, and which is not
38 dnl guaranteed by C89. 75 dnl guaranteed by both C89 and C11.
39 gl_WARN_ON_USE_PREPARE([[#include <stdio.h> 76 gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
40 ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat 77 ]], [dprintf fpurge fseeko ftello getdelim getline gets pclose popen
41 snprintf tmpfile vdprintf vsnprintf]) 78 renameat snprintf tmpfile vdprintf vsnprintf])
42]) 79])
43 80
44AC_DEFUN([gl_STDIO_MODULE_INDICATOR], 81AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
@@ -54,23 +91,31 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
54[ 91[
55 GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF]) 92 GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF])
56 GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE]) 93 GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE])
94 GNULIB_FDOPEN=0; AC_SUBST([GNULIB_FDOPEN])
57 GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) 95 GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH])
96 GNULIB_FGETC=0; AC_SUBST([GNULIB_FGETC])
97 GNULIB_FGETS=0; AC_SUBST([GNULIB_FGETS])
58 GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) 98 GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN])
59 GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF]) 99 GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF])
60 GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) 100 GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX])
61 GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE]) 101 GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE])
62 GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC]) 102 GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC])
63 GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS]) 103 GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS])
104 GNULIB_FREAD=0; AC_SUBST([GNULIB_FREAD])
64 GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN]) 105 GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN])
106 GNULIB_FSCANF=0; AC_SUBST([GNULIB_FSCANF])
65 GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) 107 GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK])
66 GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) 108 GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO])
67 GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) 109 GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL])
68 GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) 110 GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO])
69 GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE]) 111 GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE])
112 GNULIB_GETC=0; AC_SUBST([GNULIB_GETC])
113 GNULIB_GETCHAR=0; AC_SUBST([GNULIB_GETCHAR])
70 GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM]) 114 GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM])
71 GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE]) 115 GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE])
72 GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) 116 GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF])
73 GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) 117 GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
118 GNULIB_PCLOSE=0; AC_SUBST([GNULIB_PCLOSE])
74 GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR]) 119 GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR])
75 GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN]) 120 GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN])
76 GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF]) 121 GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF])
@@ -81,11 +126,15 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
81 GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE]) 126 GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE])
82 GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME]) 127 GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME])
83 GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT]) 128 GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT])
129 GNULIB_SCANF=0; AC_SUBST([GNULIB_SCANF])
84 GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) 130 GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF])
85 GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) 131 GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX])
132 GNULIB_STDIO_H_NONBLOCKING=0; AC_SUBST([GNULIB_STDIO_H_NONBLOCKING])
86 GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE]) 133 GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE])
87 GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE]) 134 GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE])
88 GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) 135 GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF])
136 GNULIB_VFSCANF=0; AC_SUBST([GNULIB_VFSCANF])
137 GNULIB_VSCANF=0; AC_SUBST([GNULIB_VSCANF])
89 GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF]) 138 GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF])
90 GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF]) 139 GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF])
91 GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) 140 GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX])
@@ -95,6 +144,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
95 GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) 144 GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX])
96 dnl Assume proper GNU behavior unless another module says otherwise. 145 dnl Assume proper GNU behavior unless another module says otherwise.
97 HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE]) 146 HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE])
147 HAVE_DECL_FSEEKO=1; AC_SUBST([HAVE_DECL_FSEEKO])
148 HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO])
98 HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) 149 HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM])
99 HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) 150 HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE])
100 HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) 151 HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF])
@@ -103,11 +154,14 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
103 HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) 154 HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF])
104 HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) 155 HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
105 HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO]) 156 HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO])
157 HAVE_PCLOSE=1; AC_SUBST([HAVE_PCLOSE])
158 HAVE_POPEN=1; AC_SUBST([HAVE_POPEN])
106 HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT]) 159 HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT])
107 HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) 160 HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF])
108 HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF]) 161 HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF])
109 REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF]) 162 REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF])
110 REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE]) 163 REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE])
164 REPLACE_FDOPEN=0; AC_SUBST([REPLACE_FDOPEN])
111 REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) 165 REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH])
112 REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) 166 REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN])
113 REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) 167 REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF])
@@ -128,6 +182,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
128 REPLACE_RENAMEAT=0; AC_SUBST([REPLACE_RENAMEAT]) 182 REPLACE_RENAMEAT=0; AC_SUBST([REPLACE_RENAMEAT])
129 REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF]) 183 REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF])
130 REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF]) 184 REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF])
185 REPLACE_STDIO_READ_FUNCS=0; AC_SUBST([REPLACE_STDIO_READ_FUNCS])
131 REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS]) 186 REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS])
132 REPLACE_TMPFILE=0; AC_SUBST([REPLACE_TMPFILE]) 187 REPLACE_TMPFILE=0; AC_SUBST([REPLACE_TMPFILE])
133 REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) 188 REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF])
@@ -137,23 +192,3 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
137 REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF]) 192 REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF])
138 REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF]) 193 REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF])
139]) 194])
140
141dnl Code shared by fseeko and ftello. Determine if large files are supported,
142dnl but stdin does not start as a large file by default.
143AC_DEFUN([gl_STDIN_LARGE_OFFSET],
144 [
145 AC_CACHE_CHECK([whether stdin defaults to large file offsets],
146 [gl_cv_var_stdin_large_offset],
147 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
148[[#if defined __SL64 && defined __SCLE /* cygwin */
149 /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
150 fseeko/ftello needlessly fail. This bug was fixed in 1.5.25, and
151 it is easier to do a version check than building a runtime test. */
152# include <cygwin/version.h>
153# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
154 choke me
155# endif
156#endif]])],
157 [gl_cv_var_stdin_large_offset=yes],
158 [gl_cv_var_stdin_large_offset=no])])
159])
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4
index dd84796..2027ab3 100644
--- a/gl/m4/stdlib_h.m4
+++ b/gl/m4/stdlib_h.m4
@@ -1,5 +1,5 @@
1# stdlib_h.m4 serial 28 1# stdlib_h.m4 serial 42
2dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -7,21 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
7AC_DEFUN([gl_STDLIB_H], 7AC_DEFUN([gl_STDLIB_H],
8[ 8[
9 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 9 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
10 gl_CHECK_NEXT_HEADERS([stdlib.h]) 10 gl_NEXT_HEADERS([stdlib.h])
11 AC_CHECK_HEADERS([random.h], [], [], [AC_INCLUDES_DEFAULT])
12 if test $ac_cv_header_random_h = yes; then
13 HAVE_RANDOM_H=1
14 else
15 HAVE_RANDOM_H=0
16 fi
17 AC_SUBST([HAVE_RANDOM_H])
18 AC_CHECK_TYPES([struct random_data],
19 [], [HAVE_STRUCT_RANDOM_DATA=0],
20 [[#include <stdlib.h>
21 #if HAVE_RANDOM_H
22 # include <random.h>
23 #endif
24 ]])
25 11
26 dnl Check for declarations of anything we want to poison if the 12 dnl Check for declarations of anything we want to poison if the
27 dnl corresponding gnulib module is not in use, and which is not 13 dnl corresponding gnulib module is not in use, and which is not
@@ -33,10 +19,11 @@ AC_DEFUN([gl_STDLIB_H],
33#if HAVE_RANDOM_H 19#if HAVE_RANDOM_H
34# include <random.h> 20# include <random.h>
35#endif 21#endif
36 ]], [atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp 22 ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
37 mkostemp mkostemps mkstemp mkstemps ptsname random_r initstat_r srandom_r 23 initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps
38 setstate_r realpath rpmatch setenv strtod strtoll strtoull unlockpt 24 posix_openpt ptsname ptsname_r random random_r realpath rpmatch
39 unsetenv]) 25 secure_getenv setenv setstate setstate_r srandom srandom_r
26 strtod strtoll strtoull unlockpt unsetenv])
40]) 27])
41 28
42AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], 29AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
@@ -50,6 +37,7 @@ AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
50 37
51AC_DEFUN([gl_STDLIB_H_DEFAULTS], 38AC_DEFUN([gl_STDLIB_H_DEFAULTS],
52[ 39[
40 GNULIB__EXIT=0; AC_SUBST([GNULIB__EXIT])
53 GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL]) 41 GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL])
54 GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) 42 GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX])
55 GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME]) 43 GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME])
@@ -57,54 +45,73 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
57 GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) 45 GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT])
58 GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT]) 46 GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT])
59 GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) 47 GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX])
48 GNULIB_MBTOWC=0; AC_SUBST([GNULIB_MBTOWC])
60 GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) 49 GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP])
61 GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP]) 50 GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP])
62 GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS]) 51 GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS])
63 GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) 52 GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP])
64 GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS]) 53 GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS])
54 GNULIB_POSIX_OPENPT=0; AC_SUBST([GNULIB_POSIX_OPENPT])
65 GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME]) 55 GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME])
56 GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R])
66 GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) 57 GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV])
58 GNULIB_RANDOM=0; AC_SUBST([GNULIB_RANDOM])
67 GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) 59 GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R])
68 GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) 60 GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
69 GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH]) 61 GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH])
70 GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) 62 GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH])
63 GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV])
71 GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) 64 GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV])
72 GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) 65 GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD])
73 GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) 66 GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL])
74 GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) 67 GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL])
68 GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX])
75 GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) 69 GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT])
76 GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) 70 GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV])
71 GNULIB_WCTOMB=0; AC_SUBST([GNULIB_WCTOMB])
77 dnl Assume proper GNU behavior unless another module says otherwise. 72 dnl Assume proper GNU behavior unless another module says otherwise.
73 HAVE__EXIT=1; AC_SUBST([HAVE__EXIT])
78 HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) 74 HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL])
79 HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX])
80 HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME]) 75 HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME])
81 HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) 76 HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG])
82 HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) 77 HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT])
83 HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) 78 HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT])
84 HAVE_MALLOC_POSIX=1; AC_SUBST([HAVE_MALLOC_POSIX])
85 HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) 79 HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
86 HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP]) 80 HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP])
87 HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) 81 HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS])
88 HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP]) 82 HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP])
89 HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS]) 83 HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS])
84 HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT])
90 HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME]) 85 HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME])
86 HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R])
87 HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM])
88 HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H])
91 HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) 89 HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
92 HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX])
93 HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) 90 HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH])
94 HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) 91 HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH])
92 HAVE_SECURE_GETENV=1; AC_SUBST([HAVE_SECURE_GETENV])
95 HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) 93 HAVE_SETENV=1; AC_SUBST([HAVE_SETENV])
94 HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV])
96 HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) 95 HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD])
97 HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) 96 HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL])
98 HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) 97 HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL])
99 HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) 98 HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA])
100 HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) 99 HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H])
101 HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) 100 HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT])
102 HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV]) 101 HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV])
102 REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC])
103 REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) 103 REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
104 REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC])
105 REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC])
104 REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) 106 REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
107 REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME])
108 REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R])
105 REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) 109 REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
110 REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R])
111 REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC])
106 REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) 112 REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH])
107 REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) 113 REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV])
108 REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) 114 REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD])
109 REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) 115 REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV])
116 REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB])
110]) 117])
diff --git a/gl/m4/strdup.m4 b/gl/m4/strdup.m4
deleted file mode 100644
index ce40c21..0000000
--- a/gl/m4/strdup.m4
+++ /dev/null
@@ -1,45 +0,0 @@
1# strdup.m4 serial 12
2
3dnl Copyright (C) 2002-2010 Free Software Foundation, Inc.
4
5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved.
8
9AC_DEFUN([gl_FUNC_STRDUP],
10[
11 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
12 AC_CHECK_FUNCS_ONCE([strdup])
13 if test $ac_cv_func_strdup != yes; then
14 AC_LIBOBJ([strdup])
15 gl_PREREQ_STRDUP
16 fi
17 AC_CHECK_DECLS_ONCE([strdup])
18 if test $ac_cv_have_decl_strdup = no; then
19 HAVE_DECL_STRDUP=0
20 fi
21])
22
23AC_DEFUN([gl_FUNC_STRDUP_POSIX],
24[
25 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
26 AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
27 AC_CHECK_FUNCS_ONCE([strdup])
28 if test $ac_cv_func_strdup = yes; then
29 if test $gl_cv_func_malloc_posix != yes; then
30 REPLACE_STRDUP=1
31 AC_LIBOBJ([strdup])
32 gl_PREREQ_STRDUP
33 fi
34 else
35 AC_LIBOBJ([strdup])
36 gl_PREREQ_STRDUP
37 fi
38 AC_CHECK_DECLS_ONCE([strdup])
39 if test $ac_cv_have_decl_strdup = no; then
40 HAVE_DECL_STRDUP=0
41 fi
42])
43
44# Prerequisites of lib/strdup.c.
45AC_DEFUN([gl_PREREQ_STRDUP], [:])
diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4
index 1649b24..3989844 100644
--- a/gl/m4/strerror.m4
+++ b/gl/m4/strerror.m4
@@ -1,68 +1,96 @@
1# strerror.m4 serial 9 1# strerror.m4 serial 17
2dnl Copyright (C) 2002, 2007-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2007-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7AC_DEFUN([gl_FUNC_STRERROR], 7AC_DEFUN([gl_FUNC_STRERROR],
8[ 8[
9 AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE])
10 if test $REPLACE_STRERROR = 1; then
11 AC_LIBOBJ([strerror])
12 AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR],
13 [Define this to 1 if strerror is broken.])
14 fi
15])
16
17# Like gl_FUNC_STRERROR, except prepare for separate compilation (no AC_LIBOBJ).
18AC_DEFUN([gl_FUNC_STRERROR_SEPARATE],
19[
20 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) 9 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
21 AC_REQUIRE([gl_HEADER_ERRNO_H]) 10 AC_REQUIRE([gl_HEADER_ERRNO_H])
22 if test -z "$ERRNO_H"; then 11 AC_REQUIRE([gl_FUNC_STRERROR_0])
12 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13 m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [
14 AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS])
15 ])
16 if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then
23 AC_CACHE_CHECK([for working strerror function], 17 AC_CACHE_CHECK([for working strerror function],
24 [gl_cv_func_working_strerror], 18 [gl_cv_func_working_strerror],
25 [AC_RUN_IFELSE( 19 [AC_RUN_IFELSE(
26 [AC_LANG_PROGRAM( 20 [AC_LANG_PROGRAM(
27 [[#include <string.h> 21 [[#include <string.h>
28 ]], 22 ]],
29 [[return !*strerror (-2);]])], 23 [[if (!*strerror (-2)) return 1;]])],
30 [gl_cv_func_working_strerror=yes], 24 [gl_cv_func_working_strerror=yes],
31 [gl_cv_func_working_strerror=no], 25 [gl_cv_func_working_strerror=no],
32 [dnl Assume crossbuild works if it compiles. 26 [case "$host_os" in
33 AC_COMPILE_IFELSE( 27 # Guess yes on glibc systems.
34 [AC_LANG_PROGRAM( 28 *-gnu*) gl_cv_func_working_strerror="guessing yes" ;;
35 [[#include <string.h> 29 # If we don't know, assume the worst.
36 ]], 30 *) gl_cv_func_working_strerror="guessing no" ;;
37 [[return !*strerror (-2);]])], 31 esac
38 [gl_cv_func_working_strerror=yes], 32 ])
39 [gl_cv_func_working_strerror=no]) 33 ])
40 ]) 34 case "$gl_cv_func_working_strerror" in
35 *yes) ;;
36 *)
37 dnl The system's strerror() fails to return a string for out-of-range
38 dnl integers. Replace it.
39 REPLACE_STRERROR=1
40 ;;
41 esac
42 m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [
43 dnl If the system's strerror_r or __xpg_strerror_r clobbers strerror's
44 dnl buffer, we must replace strerror.
45 case "$gl_cv_func_strerror_r_works" in
46 *no) REPLACE_STRERROR=1 ;;
47 esac
41 ]) 48 ])
42 if test $gl_cv_func_working_strerror = no; then
43 dnl The system's strerror() fails to return a string for out-of-range
44 dnl integers. Replace it.
45 REPLACE_STRERROR=1
46 fi
47 else 49 else
48 dnl The system's strerror() cannot know about the new errno values we add 50 dnl The system's strerror() cannot know about the new errno values we add
49 dnl to <errno.h>. Replace it. 51 dnl to <errno.h>, or any fix for strerror(0). Replace it.
50 REPLACE_STRERROR=1 52 REPLACE_STRERROR=1
51 fi 53 fi
52 if test $REPLACE_STRERROR = 1; then
53 gl_PREREQ_STRERROR
54 fi
55]) 54])
56 55
57# Prerequisites of lib/strerror.c. 56dnl Detect if strerror(0) passes (that is, does not set errno, and does not
58AC_DEFUN([gl_PREREQ_STRERROR], [ 57dnl return a string that matches strerror(-1)).
59 AC_CHECK_DECLS([strerror]) 58AC_DEFUN([gl_FUNC_STRERROR_0],
60 AC_CHECK_HEADERS_ONCE([sys/socket.h]) 59[
61 if test $ac_cv_header_sys_socket_h != yes; then 60 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
62 dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make 61 REPLACE_STRERROR_0=0
63 dnl the check for those headers unconditional; yet cygwin reports 62 AC_CACHE_CHECK([whether strerror(0) succeeds],
64 dnl that the headers are present but cannot be compiled (since on 63 [gl_cv_func_strerror_0_works],
65 dnl cygwin, all socket information should come from sys/socket.h). 64 [AC_RUN_IFELSE(
66 AC_CHECK_HEADERS([winsock2.h]) 65 [AC_LANG_PROGRAM(
67 fi 66 [[#include <string.h>
67 #include <errno.h>
68 ]],
69 [[int result = 0;
70 char *str;
71 errno = 0;
72 str = strerror (0);
73 if (!*str) result |= 1;
74 if (errno) result |= 2;
75 if (strstr (str, "nknown") || strstr (str, "ndefined"))
76 result |= 4;
77 return result;]])],
78 [gl_cv_func_strerror_0_works=yes],
79 [gl_cv_func_strerror_0_works=no],
80 [case "$host_os" in
81 # Guess yes on glibc systems.
82 *-gnu*) gl_cv_func_strerror_0_works="guessing yes" ;;
83 # If we don't know, assume the worst.
84 *) gl_cv_func_strerror_0_works="guessing no" ;;
85 esac
86 ])
87 ])
88 case "$gl_cv_func_strerror_0_works" in
89 *yes) ;;
90 *)
91 REPLACE_STRERROR_0=1
92 AC_DEFINE([REPLACE_STRERROR_0], [1], [Define to 1 if strerror(0)
93 does not return a message implying success.])
94 ;;
95 esac
68]) 96])
diff --git a/gl/m4/string_h.m4 b/gl/m4/string_h.m4
index 1977aec..cc5fbbb 100644
--- a/gl/m4/string_h.m4
+++ b/gl/m4/string_h.m4
@@ -1,11 +1,11 @@
1# Configure a GNU-like replacement for <string.h>. 1# Configure a GNU-like replacement for <string.h>.
2 2
3# Copyright (C) 2007-2010 Free Software Foundation, Inc. 3# Copyright (C) 2007-2013 Free Software Foundation, Inc.
4# This file is free software; the Free Software Foundation 4# This file is free software; the Free Software Foundation
5# gives unlimited permission to copy and/or distribute it, 5# gives unlimited permission to copy and/or distribute it,
6# with or without modifications, as long as this notice is preserved. 6# with or without modifications, as long as this notice is preserved.
7 7
8# serial 17 8# serial 21
9 9
10# Written by Paul Eggert. 10# Written by Paul Eggert.
11 11
@@ -20,16 +20,16 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY],
20[ 20[
21 AC_REQUIRE([AC_C_RESTRICT]) 21 AC_REQUIRE([AC_C_RESTRICT])
22 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) 22 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
23 gl_CHECK_NEXT_HEADERS([string.h]) 23 gl_NEXT_HEADERS([string.h])
24 24
25 dnl Check for declarations of anything we want to poison if the 25 dnl Check for declarations of anything we want to poison if the
26 dnl corresponding gnulib module is not in use, and which is not 26 dnl corresponding gnulib module is not in use, and which is not
27 dnl guaranteed by C89. 27 dnl guaranteed by C89.
28 gl_WARN_ON_USE_PREPARE([[#include <string.h> 28 gl_WARN_ON_USE_PREPARE([[#include <string.h>
29 ]], 29 ]],
30 [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup 30 [ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul
31 strncat strndup strnlen strpbrk strsep strcasestr strtok_r strsignal 31 strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r
32 strverscmp]) 32 strerror_r strsignal strverscmp])
33]) 33])
34 34
35AC_DEFUN([gl_STRING_MODULE_INDICATOR], 35AC_DEFUN([gl_STRING_MODULE_INDICATOR],
@@ -43,6 +43,8 @@ AC_DEFUN([gl_STRING_MODULE_INDICATOR],
43 43
44AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], 44AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
45[ 45[
46 GNULIB_FFSL=0; AC_SUBST([GNULIB_FFSL])
47 GNULIB_FFSLL=0; AC_SUBST([GNULIB_FFSLL])
46 GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR]) 48 GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR])
47 GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM]) 49 GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM])
48 GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY]) 50 GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY])
@@ -75,10 +77,13 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
75 GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) 77 GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP])
76 GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) 78 GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R])
77 GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) 79 GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR])
80 GNULIB_STRERROR_R=0; AC_SUBST([GNULIB_STRERROR_R])
78 GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) 81 GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL])
79 GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) 82 GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
80 HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) 83 HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN])
81 dnl Assume proper GNU behavior unless another module says otherwise. 84 dnl Assume proper GNU behavior unless another module says otherwise.
85 HAVE_FFSL=1; AC_SUBST([HAVE_FFSL])
86 HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL])
82 HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR]) 87 HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR])
83 HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) 88 HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
84 HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) 89 HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
@@ -94,6 +99,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
94 HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) 99 HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP])
95 HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) 100 HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
96 HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) 101 HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
102 HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R])
97 HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) 103 HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL])
98 HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) 104 HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP])
99 REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) 105 REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR])
@@ -102,7 +108,9 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
102 REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) 108 REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP])
103 REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) 109 REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
104 REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) 110 REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR])
111 REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL])
105 REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) 112 REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
113 REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R])
106 REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) 114 REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT])
107 REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) 115 REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP])
108 REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) 116 REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN])
diff --git a/gl/m4/strndup.m4 b/gl/m4/strndup.m4
index 810313c..a1f8274 100644
--- a/gl/m4/strndup.m4
+++ b/gl/m4/strndup.m4
@@ -1,5 +1,5 @@
1# strndup.m4 serial 17 1# strndup.m4 serial 21
2dnl Copyright (C) 2002-2003, 2005-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2003, 2005-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -18,13 +18,18 @@ AC_DEFUN([gl_FUNC_STRNDUP],
18 fi 18 fi
19 19
20 if test $ac_cv_func_strndup = yes; then 20 if test $ac_cv_func_strndup = yes; then
21 HAVE_STRNDUP=1
21 # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. 22 # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'.
22 AC_CACHE_CHECK([for working strndup], [gl_cv_func_strndup_works], 23 AC_CACHE_CHECK([for working strndup], [gl_cv_func_strndup_works],
23 [AC_RUN_IFELSE([ 24 [AC_RUN_IFELSE([
24 AC_LANG_PROGRAM([[#include <string.h> 25 AC_LANG_PROGRAM([[#include <string.h>
25 #include <stdlib.h>]], [[ 26 #include <stdlib.h>]], [[
26#ifndef HAVE_DECL_STRNDUP 27#if !HAVE_DECL_STRNDUP
27 extern char *strndup (const char *, size_t); 28 extern
29 #ifdef __cplusplus
30 "C"
31 #endif
32 char *strndup (const char *, size_t);
28#endif 33#endif
29 char *s; 34 char *s;
30 s = strndup ("some longer string", 15); 35 s = strndup ("some longer string", 15);
@@ -33,17 +38,18 @@ AC_DEFUN([gl_FUNC_STRNDUP],
33 return s[13] != '\0';]])], 38 return s[13] != '\0';]])],
34 [gl_cv_func_strndup_works=yes], 39 [gl_cv_func_strndup_works=yes],
35 [gl_cv_func_strndup_works=no], 40 [gl_cv_func_strndup_works=no],
36 [case $host_os in 41 [
37 aix*) gl_cv_func_strndup_works="guessing no";; 42changequote(,)dnl
38 *) gl_cv_func_strndup_works="guessing yes";; 43 case $host_os in
39 esac])]) 44 aix | aix[3-6]*) gl_cv_func_strndup_works="guessing no";;
45 *) gl_cv_func_strndup_works="guessing yes";;
46 esac
47changequote([,])dnl
48 ])])
40 case $gl_cv_func_strndup_works in 49 case $gl_cv_func_strndup_works in
41 *no) 50 *no) REPLACE_STRNDUP=1 ;;
42 REPLACE_STRNDUP=1
43 AC_LIBOBJ([strndup])
44 ;;
45 esac 51 esac
46 else 52 else
47 AC_LIBOBJ([strndup]) 53 HAVE_STRNDUP=0
48 fi 54 fi
49]) 55])
diff --git a/gl/m4/strnlen.m4 b/gl/m4/strnlen.m4
index 52bb838..eae82b7 100644
--- a/gl/m4/strnlen.m4
+++ b/gl/m4/strnlen.m4
@@ -1,5 +1,5 @@
1# strnlen.m4 serial 12 1# strnlen.m4 serial 13
2dnl Copyright (C) 2002-2003, 2005-2007, 2009-2010 Free Software Foundation, 2dnl Copyright (C) 2002-2003, 2005-2007, 2009-2013 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -16,16 +16,14 @@ AC_DEFUN([gl_FUNC_STRNLEN],
16 if test $ac_cv_have_decl_strnlen = no; then 16 if test $ac_cv_have_decl_strnlen = no; then
17 HAVE_DECL_STRNLEN=0 17 HAVE_DECL_STRNLEN=0
18 else 18 else
19 AC_FUNC_STRNLEN 19 m4_pushdef([AC_LIBOBJ], [:])
20 dnl Note: AC_FUNC_STRNLEN does AC_LIBOBJ([strnlen]). 20 dnl Note: AC_FUNC_STRNLEN does AC_LIBOBJ([strnlen]).
21 AC_FUNC_STRNLEN
22 m4_popdef([AC_LIBOBJ])
21 if test $ac_cv_func_strnlen_working = no; then 23 if test $ac_cv_func_strnlen_working = no; then
22 REPLACE_STRNLEN=1 24 REPLACE_STRNLEN=1
23 fi 25 fi
24 fi 26 fi
25 if test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1; then
26 AC_LIBOBJ([strnlen])
27 gl_PREREQ_STRNLEN
28 fi
29]) 27])
30 28
31# Prerequisites of lib/strnlen.c. 29# Prerequisites of lib/strnlen.c.
diff --git a/gl/m4/strsep.m4 b/gl/m4/strsep.m4
index fb4d396..825fdb8 100644
--- a/gl/m4/strsep.m4
+++ b/gl/m4/strsep.m4
@@ -1,6 +1,5 @@
1# strsep.m4 serial 9 1# strsep.m4 serial 10
2dnl Copyright (C) 2002, 2003, 2004, 2007, 2009, 2010 Free Software Foundation, 2dnl Copyright (C) 2002-2004, 2007, 2009-2013 Free Software Foundation, Inc.
3dnl Inc.
4dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -14,10 +13,9 @@ AC_DEFUN([gl_FUNC_STRSEP],
14 AC_REQUIRE([AC_C_RESTRICT]) 13 AC_REQUIRE([AC_C_RESTRICT])
15 14
16 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) 15 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
17 AC_REPLACE_FUNCS([strsep]) 16 AC_CHECK_FUNCS([strsep])
18 if test $ac_cv_func_strsep = no; then 17 if test $ac_cv_func_strsep = no; then
19 HAVE_STRSEP=0 18 HAVE_STRSEP=0
20 gl_PREREQ_STRSEP
21 fi 19 fi
22]) 20])
23 21
diff --git a/gl/m4/strstr.m4 b/gl/m4/strstr.m4
index 779957a..c486bdb 100644
--- a/gl/m4/strstr.m4
+++ b/gl/m4/strstr.m4
@@ -1,5 +1,5 @@
1# strstr.m4 serial 7 1# strstr.m4 serial 16
2dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -11,7 +11,51 @@ AC_DEFUN([gl_FUNC_STRSTR_SIMPLE],
11 AC_REQUIRE([gl_FUNC_MEMCHR]) 11 AC_REQUIRE([gl_FUNC_MEMCHR])
12 if test "$gl_cv_func_memchr_works" != yes; then 12 if test "$gl_cv_func_memchr_works" != yes; then
13 REPLACE_STRSTR=1 13 REPLACE_STRSTR=1
14 AC_LIBOBJ([strstr]) 14 else
15 dnl Detect http://sourceware.org/bugzilla/show_bug.cgi?id=12092.
16 AC_CACHE_CHECK([whether strstr works],
17 [gl_cv_func_strstr_works_always],
18 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
19#include <string.h> /* for strstr */
20#define P "_EF_BF_BD"
21#define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P
22#define NEEDLE P P P P P
23]], [[return !!strstr (HAYSTACK, NEEDLE);
24 ]])],
25 [gl_cv_func_strstr_works_always=yes],
26 [gl_cv_func_strstr_works_always=no],
27 [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not
28 dnl affected, since it uses different source code for strstr than
29 dnl glibc.
30 dnl Assume that it works on all other platforms, even if it is not
31 dnl linear.
32 AC_EGREP_CPP([Lucky user],
33 [
34#ifdef __GNU_LIBRARY__
35 #include <features.h>
36 #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \
37 || defined __UCLIBC__
38 Lucky user
39 #endif
40#elif defined __CYGWIN__
41 #include <cygwin/version.h>
42 #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7)
43 Lucky user
44 #endif
45#else
46 Lucky user
47#endif
48 ],
49 [gl_cv_func_strstr_works_always="guessing yes"],
50 [gl_cv_func_strstr_works_always="guessing no"])
51 ])
52 ])
53 case "$gl_cv_func_strstr_works_always" in
54 *yes) ;;
55 *)
56 REPLACE_STRSTR=1
57 ;;
58 esac
15 fi 59 fi
16]) # gl_FUNC_STRSTR_SIMPLE 60]) # gl_FUNC_STRSTR_SIMPLE
17 61
@@ -24,16 +68,18 @@ AC_DEFUN([gl_FUNC_STRSTR],
24 [gl_cv_func_strstr_linear], 68 [gl_cv_func_strstr_linear],
25 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ 69 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
26#include <signal.h> /* for signal */ 70#include <signal.h> /* for signal */
27#include <string.h> /* for memmem */ 71#include <string.h> /* for strstr */
28#include <stdlib.h> /* for malloc */ 72#include <stdlib.h> /* for malloc */
29#include <unistd.h> /* for alarm */ 73#include <unistd.h> /* for alarm */
30]], [[size_t m = 1000000; 74static void quit (int sig) { exit (sig + 128); }
75]], [[
76 int result = 0;
77 size_t m = 1000000;
31 char *haystack = (char *) malloc (2 * m + 2); 78 char *haystack = (char *) malloc (2 * m + 2);
32 char *needle = (char *) malloc (m + 2); 79 char *needle = (char *) malloc (m + 2);
33 void *result = 0;
34 /* Failure to compile this test due to missing alarm is okay, 80 /* Failure to compile this test due to missing alarm is okay,
35 since all such platforms (mingw) also have quadratic strstr. */ 81 since all such platforms (mingw) also have quadratic strstr. */
36 signal (SIGALRM, SIG_DFL); 82 signal (SIGALRM, quit);
37 alarm (5); 83 alarm (5);
38 /* Check for quadratic performance. */ 84 /* Check for quadratic performance. */
39 if (haystack && needle) 85 if (haystack && needle)
@@ -44,36 +90,41 @@ AC_DEFUN([gl_FUNC_STRSTR],
44 memset (needle, 'A', m); 90 memset (needle, 'A', m);
45 needle[m] = 'B'; 91 needle[m] = 'B';
46 needle[m + 1] = 0; 92 needle[m + 1] = 0;
47 result = strstr (haystack, needle); 93 if (!strstr (haystack, needle))
94 result |= 1;
48 } 95 }
49 return !result;]])], 96 return result;
97 ]])],
50 [gl_cv_func_strstr_linear=yes], [gl_cv_func_strstr_linear=no], 98 [gl_cv_func_strstr_linear=yes], [gl_cv_func_strstr_linear=no],
51 [dnl Only glibc >= 2.9 and cygwin >= 1.7.0 are known to have a 99 [dnl Only glibc > 2.12 on processors without SSE 4.2 instructions and
52 dnl strstr that works in linear time. 100 dnl cygwin > 1.7.7 are known to have a bug-free strstr that works in
101 dnl linear time.
53 AC_EGREP_CPP([Lucky user], 102 AC_EGREP_CPP([Lucky user],
54 [ 103 [
55#include <features.h> 104#include <features.h>
56#ifdef __GNU_LIBRARY__ 105#ifdef __GNU_LIBRARY__
57 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 9) || (__GLIBC__ > 2) 106 #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \
107 && !(defined __i386__ || defined __x86_64__) \
108 && !defined __UCLIBC__
58 Lucky user 109 Lucky user
59 #endif 110 #endif
60#endif 111#endif
61#ifdef __CYGWIN__ 112#ifdef __CYGWIN__
62 #include <cygwin/version.h> 113 #include <cygwin/version.h>
63 #if CYGWIN_VERSION_DLL_MAJOR >= 1007 114 #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7)
64 Lucky user 115 Lucky user
65 #endif 116 #endif
66#endif 117#endif
67 ], 118 ],
68 [gl_cv_func_strstr_linear=yes], 119 [gl_cv_func_strstr_linear="guessing yes"],
69 [gl_cv_func_strstr_linear="guessing no"]) 120 [gl_cv_func_strstr_linear="guessing no"])
70 ]) 121 ])
71 ]) 122 ])
72 if test "$gl_cv_func_strstr_linear" != yes; then 123 case "$gl_cv_func_strstr_linear" in
73 REPLACE_STRSTR=1 124 *yes) ;;
74 fi 125 *)
75 fi 126 REPLACE_STRSTR=1
76 if test $REPLACE_STRSTR = 1; then 127 ;;
77 AC_LIBOBJ([strstr]) 128 esac
78 fi 129 fi
79]) # gl_FUNC_STRSTR 130]) # gl_FUNC_STRSTR
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4
index 9f4db56..9486377 100644
--- a/gl/m4/sys_socket_h.m4
+++ b/gl/m4/sys_socket_h.m4
@@ -1,5 +1,5 @@
1# sys_socket_h.m4 serial 17 1# sys_socket_h.m4 serial 23
2dnl Copyright (C) 2005-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2005-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -9,7 +9,18 @@ dnl From Simon Josefsson.
9AC_DEFUN([gl_HEADER_SYS_SOCKET], 9AC_DEFUN([gl_HEADER_SYS_SOCKET],
10[ 10[
11 AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) 11 AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
12 AC_REQUIRE([AC_C_INLINE]) 12 AC_REQUIRE([AC_CANONICAL_HOST])
13
14 dnl On OSF/1, the functions recv(), send(), recvfrom(), sendto() have
15 dnl old-style declarations (with return type 'int' instead of 'ssize_t')
16 dnl unless _POSIX_PII_SOCKET is defined.
17 case "$host_os" in
18 osf*)
19 AC_DEFINE([_POSIX_PII_SOCKET], [1],
20 [Define to 1 in order to get the POSIX compatible declarations
21 of socket functions.])
22 ;;
23 esac
13 24
14 AC_CACHE_CHECK([whether <sys/socket.h> is self-contained], 25 AC_CACHE_CHECK([whether <sys/socket.h> is self-contained],
15 [gl_cv_header_sys_socket_h_selfcontained], 26 [gl_cv_header_sys_socket_h_selfcontained],
@@ -57,6 +68,23 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
57 if test $ac_cv_type_sa_family_t = no; then 68 if test $ac_cv_type_sa_family_t = no; then
58 HAVE_SA_FAMILY_T=0 69 HAVE_SA_FAMILY_T=0
59 fi 70 fi
71 if test $ac_cv_type_struct_sockaddr_storage != no; then
72 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],
73 [],
74 [HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=0],
75 [#include <sys/types.h>
76 #ifdef HAVE_SYS_SOCKET_H
77 #include <sys/socket.h>
78 #endif
79 #ifdef HAVE_WS2TCPIP_H
80 #include <ws2tcpip.h>
81 #endif
82 ])
83 fi
84 if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \
85 || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then
86 SYS_SOCKET_H='sys/socket.h'
87 fi
60 gl_PREREQ_SYS_H_WINSOCK2 88 gl_PREREQ_SYS_H_WINSOCK2
61 89
62 dnl Check for declarations of anything we want to poison if the 90 dnl Check for declarations of anything we want to poison if the
@@ -64,10 +92,7 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
64 gl_WARN_ON_USE_PREPARE([[ 92 gl_WARN_ON_USE_PREPARE([[
65/* Some systems require prerequisite headers. */ 93/* Some systems require prerequisite headers. */
66#include <sys/types.h> 94#include <sys/types.h>
67#if !defined __GLIBC__ && HAVE_SYS_TIME_H 95#include <sys/socket.h>
68# include <sys/time.h>
69#endif
70#include <sys/select.h>
71 ]], [socket connect accept bind getpeername getsockname getsockopt 96 ]], [socket connect accept bind getpeername getsockname getsockopt
72 listen recv send recvfrom sendto setsockopt shutdown accept4]) 97 listen recv send recvfrom sendto setsockopt shutdown accept4])
73]) 98])
@@ -75,17 +100,13 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
75AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], 100AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
76[ 101[
77 dnl Check prerequisites of the <sys/socket.h> replacement. 102 dnl Check prerequisites of the <sys/socket.h> replacement.
103 AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])
78 gl_CHECK_NEXT_HEADERS([sys/socket.h]) 104 gl_CHECK_NEXT_HEADERS([sys/socket.h])
79 if test $ac_cv_header_sys_socket_h = yes; then 105 if test $ac_cv_header_sys_socket_h = yes; then
80 HAVE_SYS_SOCKET_H=1 106 HAVE_SYS_SOCKET_H=1
81 HAVE_WS2TCPIP_H=0 107 HAVE_WS2TCPIP_H=0
82 else 108 else
83 HAVE_SYS_SOCKET_H=0 109 HAVE_SYS_SOCKET_H=0
84 dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
85 dnl the check for those headers unconditional; yet cygwin reports
86 dnl that the headers are present but cannot be compiled (since on
87 dnl cygwin, all socket information should come from sys/socket.h).
88 AC_CHECK_HEADERS([ws2tcpip.h])
89 if test $ac_cv_header_ws2tcpip_h = yes; then 110 if test $ac_cv_header_ws2tcpip_h = yes; then
90 HAVE_WS2TCPIP_H=1 111 HAVE_WS2TCPIP_H=1
91 else 112 else
@@ -148,6 +169,8 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
148 GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) 169 GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN])
149 GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4]) 170 GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4])
150 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) 171 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
172 HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1;
173 AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY])
151 HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T]) 174 HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T])
152 HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) 175 HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4])
153]) 176])
diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4
deleted file mode 100644
index 7181c25..0000000
--- a/gl/m4/sys_stat_h.m4
+++ /dev/null
@@ -1,82 +0,0 @@
1# sys_stat_h.m4 serial 24 -*- Autoconf -*-
2dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Eric Blake.
8dnl Provide a GNU-like <sys/stat.h>.
9
10AC_DEFUN([gl_HEADER_SYS_STAT_H],
11[
12 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
13
14 dnl For the mkdir substitute.
15 AC_REQUIRE([AC_C_INLINE])
16
17 dnl Check for broken stat macros.
18 AC_REQUIRE([AC_HEADER_STAT])
19
20 gl_CHECK_NEXT_HEADERS([sys/stat.h])
21
22 dnl Define types that are supposed to be defined in <sys/types.h> or
23 dnl <sys/stat.h>.
24 AC_CHECK_TYPE([nlink_t], [],
25 [AC_DEFINE([nlink_t], [int],
26 [Define to the type of st_nlink in struct stat, or a supertype.])],
27 [#include <sys/types.h>
28 #include <sys/stat.h>])
29
30 dnl Check for declarations of anything we want to poison if the
31 dnl corresponding gnulib module is not in use.
32 gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
33 ]], [fchmodat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
34 mknod mknodat stat utimensat])
35]) # gl_HEADER_SYS_STAT_H
36
37AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
38[
39 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
40 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
41 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
42 dnl Define it also as a C macro, for the benefit of the unit tests.
43 gl_MODULE_INDICATOR_FOR_TESTS([$1])
44])
45
46AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
47[
48 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
49 GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT])
50 GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT])
51 GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS])
52 GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
53 GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT])
54 GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT])
55 GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO])
56 GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT])
57 GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD])
58 GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT])
59 GNULIB_STAT=0; AC_SUBST([GNULIB_STAT])
60 GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT])
61 dnl Assume proper GNU behavior unless another module says otherwise.
62 HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT])
63 HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT])
64 HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS])
65 HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD])
66 HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT])
67 HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT])
68 HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO])
69 HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT])
70 HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD])
71 HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT])
72 HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT])
73 REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT])
74 REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT])
75 REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS])
76 REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT])
77 REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
78 REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO])
79 REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD])
80 REPLACE_STAT=0; AC_SUBST([REPLACE_STAT])
81 REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT])
82])
diff --git a/gl/m4/sys_types_h.m4 b/gl/m4/sys_types_h.m4
new file mode 100644
index 0000000..d15c1b3
--- /dev/null
+++ b/gl/m4/sys_types_h.m4
@@ -0,0 +1,24 @@
1# sys_types_h.m4 serial 5
2dnl Copyright (C) 2011-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN_ONCE([gl_SYS_TYPES_H],
8[
9 AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS])
10 gl_NEXT_HEADERS([sys/types.h])
11
12 dnl Ensure the type pid_t gets defined.
13 AC_REQUIRE([AC_TYPE_PID_T])
14
15 dnl Ensure the type mode_t gets defined.
16 AC_REQUIRE([AC_TYPE_MODE_T])
17
18 dnl Whether to override the 'off_t' type.
19 AC_REQUIRE([gl_TYPE_OFF_T])
20])
21
22AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS],
23[
24])
diff --git a/gl/m4/sys_uio_h.m4 b/gl/m4/sys_uio_h.m4
new file mode 100644
index 0000000..c75cbbd
--- /dev/null
+++ b/gl/m4/sys_uio_h.m4
@@ -0,0 +1,31 @@
1# sys_uio_h.m4 serial 1
2dnl Copyright (C) 2011-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_HEADER_SYS_UIO],
8[
9 AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS])
10 dnl <sys/uio.h> is always overridden, because of GNULIB_POSIXCHECK.
11 gl_CHECK_NEXT_HEADERS([sys/uio.h])
12 if test $ac_cv_header_sys_uio_h = yes; then
13 HAVE_SYS_UIO_H=1
14 else
15 HAVE_SYS_UIO_H=0
16 fi
17 AC_SUBST([HAVE_SYS_UIO_H])
18])
19
20AC_DEFUN([gl_SYS_UIO_MODULE_INDICATOR],
21[
22 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
23 AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS])
24 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
25 dnl Define it also as a C macro, for the benefit of the unit tests.
26 gl_MODULE_INDICATOR_FOR_TESTS([$1])
27])
28
29AC_DEFUN([gl_SYS_UIO_H_DEFAULTS],
30[
31])
diff --git a/gl/m4/threadlib.m4 b/gl/m4/threadlib.m4
index 05cc4ff..26bdeb5 100644
--- a/gl/m4/threadlib.m4
+++ b/gl/m4/threadlib.m4
@@ -1,5 +1,5 @@
1# threadlib.m4 serial 5 (gettext-0.18) 1# threadlib.m4 serial 10 (gettext-0.18.2)
2dnl Copyright (C) 2005-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2005-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -9,8 +9,13 @@ dnl From Bruno Haible.
9dnl gl_THREADLIB 9dnl gl_THREADLIB
10dnl ------------ 10dnl ------------
11dnl Tests for a multithreading library to be used. 11dnl Tests for a multithreading library to be used.
12dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO
13dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the
14dnl default is 'no', otherwise it is system dependent. In both cases, the user
15dnl can change the choice through the options --enable-threads=choice or
16dnl --disable-threads.
12dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS, 17dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS,
13dnl USE_PTH_THREADS, USE_WIN32_THREADS 18dnl USE_PTH_THREADS, USE_WINDOWS_THREADS
14dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use 19dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use
15dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with 20dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with
16dnl libtool). 21dnl libtool).
@@ -44,10 +49,12 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY],
44 [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], 49 [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])],
45 [AC_REQUIRE([AC_GNU_SOURCE])]) 50 [AC_REQUIRE([AC_GNU_SOURCE])])
46 dnl Check for multithreading. 51 dnl Check for multithreading.
47 m4_divert_text([DEFAULTS], [gl_use_threads_default=]) 52 m4_ifdef([gl_THREADLIB_DEFAULT_NO],
53 [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])],
54 [m4_divert_text([DEFAULTS], [gl_use_threads_default=])])
48 AC_ARG_ENABLE([threads], 55 AC_ARG_ENABLE([threads],
49AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API]) 56AC_HELP_STRING([--enable-threads={posix|solaris|pth|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [
50AC_HELP_STRING([--disable-threads], [build without multithread safety]), 57AC_HELP_STRING([--disable-threads], [build without multithread safety])]),
51 [gl_use_threads=$enableval], 58 [gl_use_threads=$enableval],
52 [if test -n "$gl_use_threads_default"; then 59 [if test -n "$gl_use_threads_default"; then
53 gl_use_threads="$gl_use_threads_default" 60 gl_use_threads="$gl_use_threads_default"
@@ -80,7 +87,7 @@ changequote([,])dnl
80 # groks <pthread.h>. cc also understands the flag -pthread, but 87 # groks <pthread.h>. cc also understands the flag -pthread, but
81 # we don't use it because 1. gcc-2.95 doesn't understand -pthread, 88 # we don't use it because 1. gcc-2.95 doesn't understand -pthread,
82 # 2. putting a flag into CPPFLAGS that has an effect on the linker 89 # 2. putting a flag into CPPFLAGS that has an effect on the linker
83 # causes the AC_TRY_LINK test below to succeed unexpectedly, 90 # causes the AC_LINK_IFELSE test below to succeed unexpectedly,
84 # leading to wrong values of LIBTHREAD and LTLIBTHREAD. 91 # leading to wrong values of LIBTHREAD and LTLIBTHREAD.
85 CPPFLAGS="$CPPFLAGS -D_REENTRANT" 92 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
86 ;; 93 ;;
@@ -111,18 +118,25 @@ AC_DEFUN([gl_THREADLIB_BODY],
111 [gl_cv_have_weak], 118 [gl_cv_have_weak],
112 [gl_cv_have_weak=no 119 [gl_cv_have_weak=no
113 dnl First, test whether the compiler accepts it syntactically. 120 dnl First, test whether the compiler accepts it syntactically.
114 AC_TRY_LINK([extern void xyzzy (); 121 AC_LINK_IFELSE(
115#pragma weak xyzzy], [xyzzy();], [gl_cv_have_weak=maybe]) 122 [AC_LANG_PROGRAM(
123 [[extern void xyzzy ();
124#pragma weak xyzzy]],
125 [[xyzzy();]])],
126 [gl_cv_have_weak=maybe])
116 if test $gl_cv_have_weak = maybe; then 127 if test $gl_cv_have_weak = maybe; then
117 dnl Second, test whether it actually works. On Cygwin 1.7.2, with 128 dnl Second, test whether it actually works. On Cygwin 1.7.2, with
118 dnl gcc 4.3, symbols declared weak always evaluate to the address 0. 129 dnl gcc 4.3, symbols declared weak always evaluate to the address 0.
119 AC_TRY_RUN([ 130 AC_RUN_IFELSE(
131 [AC_LANG_SOURCE([[
120#include <stdio.h> 132#include <stdio.h>
121#pragma weak fputs 133#pragma weak fputs
122int main () 134int main ()
123{ 135{
124 return (fputs == NULL); 136 return (fputs == NULL);
125}], [gl_cv_have_weak=yes], [gl_cv_have_weak=no], 137}]])],
138 [gl_cv_have_weak=yes],
139 [gl_cv_have_weak=no],
126 [dnl When cross-compiling, assume that only ELF platforms support 140 [dnl When cross-compiling, assume that only ELF platforms support
127 dnl weak symbols. 141 dnl weak symbols.
128 AC_EGREP_CPP([Extensible Linking Format], 142 AC_EGREP_CPP([Extensible Linking Format],
@@ -148,9 +162,11 @@ int main ()
148 # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist 162 # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist
149 # in libc. IRIX 6.5 has the first one in both libc and libpthread, but 163 # in libc. IRIX 6.5 has the first one in both libc and libpthread, but
150 # the second one only in libpthread, and lock.c needs it. 164 # the second one only in libpthread, and lock.c needs it.
151 AC_TRY_LINK([#include <pthread.h>], 165 AC_LINK_IFELSE(
152 [pthread_mutex_lock((pthread_mutex_t*)0); 166 [AC_LANG_PROGRAM(
153 pthread_mutexattr_init((pthread_mutexattr_t*)0);], 167 [[#include <pthread.h>]],
168 [[pthread_mutex_lock((pthread_mutex_t*)0);
169 pthread_mutexattr_init((pthread_mutexattr_t*)0);]])],
154 [gl_have_pthread=yes]) 170 [gl_have_pthread=yes])
155 # Test for libpthread by looking for pthread_kill. (Not pthread_self, 171 # Test for libpthread by looking for pthread_kill. (Not pthread_self,
156 # since it is defined as a macro on OSF/1.) 172 # since it is defined as a macro on OSF/1.)
@@ -203,9 +219,13 @@ int main ()
203 gl_have_solaristhread= 219 gl_have_solaristhread=
204 gl_save_LIBS="$LIBS" 220 gl_save_LIBS="$LIBS"
205 LIBS="$LIBS -lthread" 221 LIBS="$LIBS -lthread"
206 AC_TRY_LINK([#include <thread.h> 222 AC_LINK_IFELSE(
207#include <synch.h>], 223 [AC_LANG_PROGRAM(
208 [thr_self();], 224 [[
225#include <thread.h>
226#include <synch.h>
227 ]],
228 [[thr_self();]])],
209 [gl_have_solaristhread=yes]) 229 [gl_have_solaristhread=yes])
210 LIBS="$gl_save_LIBS" 230 LIBS="$gl_save_LIBS"
211 if test -n "$gl_have_solaristhread"; then 231 if test -n "$gl_have_solaristhread"; then
@@ -230,8 +250,10 @@ int main ()
230 AC_LIB_LINKFLAGS([pth]) 250 AC_LIB_LINKFLAGS([pth])
231 gl_have_pth= 251 gl_have_pth=
232 gl_save_LIBS="$LIBS" 252 gl_save_LIBS="$LIBS"
233 LIBS="$LIBS -lpth" 253 LIBS="$LIBS $LIBPTH"
234 AC_TRY_LINK([#include <pth.h>], [pth_self();], [gl_have_pth=yes]) 254 AC_LINK_IFELSE(
255 [AC_LANG_PROGRAM([[#include <pth.h>]], [[pth_self();]])],
256 [gl_have_pth=yes])
235 LIBS="$gl_save_LIBS" 257 LIBS="$gl_save_LIBS"
236 if test -n "$gl_have_pth"; then 258 if test -n "$gl_have_pth"; then
237 gl_threads_api=pth 259 gl_threads_api=pth
@@ -254,17 +276,19 @@ int main ()
254 fi 276 fi
255 fi 277 fi
256 if test -z "$gl_have_pthread"; then 278 if test -z "$gl_have_pthread"; then
257 if test "$gl_use_threads" = yes || test "$gl_use_threads" = win32; then 279 case "$gl_use_threads" in
258 if { case "$host_os" in 280 yes | windows | win32) # The 'win32' is for backward compatibility.
259 mingw*) true;; 281 if { case "$host_os" in
260 *) false;; 282 mingw*) true;;
261 esac 283 *) false;;
262 }; then 284 esac
263 gl_threads_api=win32 285 }; then
264 AC_DEFINE([USE_WIN32_THREADS], [1], 286 gl_threads_api=windows
265 [Define if the Win32 multithreading API can be used.]) 287 AC_DEFINE([USE_WINDOWS_THREADS], [1],
266 fi 288 [Define if the native Windows multithreading API can be used.])
267 fi 289 fi
290 ;;
291 esac
268 fi 292 fi
269 fi 293 fi
270 AC_MSG_CHECKING([for multithread API to use]) 294 AC_MSG_CHECKING([for multithread API to use])
@@ -295,50 +319,50 @@ AC_DEFUN([gl_DISABLE_THREADS], [
295 319
296dnl Survey of platforms: 320dnl Survey of platforms:
297dnl 321dnl
298dnl Platform Available Compiler Supports test-lock 322dnl Platform Available Compiler Supports test-lock
299dnl flavours option weak result 323dnl flavours option weak result
300dnl --------------- --------- --------- -------- --------- 324dnl --------------- --------- --------- -------- ---------
301dnl Linux 2.4/glibc posix -lpthread Y OK 325dnl Linux 2.4/glibc posix -lpthread Y OK
302dnl 326dnl
303dnl GNU Hurd/glibc posix 327dnl GNU Hurd/glibc posix
304dnl 328dnl
305dnl FreeBSD 5.3 posix -lc_r Y 329dnl FreeBSD 5.3 posix -lc_r Y
306dnl posix -lkse ? Y 330dnl posix -lkse ? Y
307dnl posix -lpthread ? Y 331dnl posix -lpthread ? Y
308dnl posix -lthr Y 332dnl posix -lthr Y
309dnl 333dnl
310dnl FreeBSD 5.2 posix -lc_r Y 334dnl FreeBSD 5.2 posix -lc_r Y
311dnl posix -lkse Y 335dnl posix -lkse Y
312dnl posix -lthr Y 336dnl posix -lthr Y
313dnl 337dnl
314dnl FreeBSD 4.0,4.10 posix -lc_r Y OK 338dnl FreeBSD 4.0,4.10 posix -lc_r Y OK
315dnl 339dnl
316dnl NetBSD 1.6 -- 340dnl NetBSD 1.6 --
317dnl 341dnl
318dnl OpenBSD 3.4 posix -lpthread Y OK 342dnl OpenBSD 3.4 posix -lpthread Y OK
319dnl 343dnl
320dnl MacOS X 10.[123] posix -lpthread Y OK 344dnl Mac OS X 10.[123] posix -lpthread Y OK
321dnl 345dnl
322dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK 346dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK
323dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK 347dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK
324dnl 348dnl
325dnl HP-UX 11 posix -lpthread N (cc) OK 349dnl HP-UX 11 posix -lpthread N (cc) OK
326dnl Y (gcc) 350dnl Y (gcc)
327dnl 351dnl
328dnl IRIX 6.5 posix -lpthread Y 0.5 352dnl IRIX 6.5 posix -lpthread Y 0.5
329dnl 353dnl
330dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK 354dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK
331dnl 355dnl
332dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK 356dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK
333dnl -lpthread (gcc) Y 357dnl -lpthread (gcc) Y
334dnl 358dnl
335dnl Cygwin posix -lpthread Y OK 359dnl Cygwin posix -lpthread Y OK
336dnl 360dnl
337dnl Any of the above pth -lpth 0.0 361dnl Any of the above pth -lpth 0.0
338dnl 362dnl
339dnl Mingw win32 N OK 363dnl Mingw windows N OK
340dnl 364dnl
341dnl BeOS 5 -- 365dnl BeOS 5 --
342dnl 366dnl
343dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is 367dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is
344dnl turned off: 368dnl turned off:
diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4
index a45a10a..3b83900 100644
--- a/gl/m4/time_h.m4
+++ b/gl/m4/time_h.m4
@@ -1,8 +1,8 @@
1# Configure a more-standard replacement for <time.h>. 1# Configure a more-standard replacement for <time.h>.
2 2
3# Copyright (C) 2000-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc. 3# Copyright (C) 2000-2001, 2003-2007, 2009-2013 Free Software Foundation, Inc.
4 4
5# serial 2 5# serial 7
6 6
7# This file is free software; the Free Software Foundation 7# This file is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it, 8# gives unlimited permission to copy and/or distribute it,
@@ -21,11 +21,11 @@ AC_DEFUN([gl_HEADER_TIME_H_BODY],
21[ 21[
22 AC_REQUIRE([AC_C_RESTRICT]) 22 AC_REQUIRE([AC_C_RESTRICT])
23 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) 23 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
24 gl_CHECK_NEXT_HEADERS([time.h]) 24 gl_NEXT_HEADERS([time.h])
25 AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) 25 AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
26]) 26])
27 27
28dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared 28dnl Check whether 'struct timespec' is declared
29dnl in time.h, sys/time.h, or pthread.h. 29dnl in time.h, sys/time.h, or pthread.h.
30 30
31AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], 31AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
@@ -95,7 +95,7 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
95 GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM]) 95 GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM])
96 GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R]) 96 GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R])
97 dnl Assume proper GNU behavior unless another module says otherwise. 97 dnl Assume proper GNU behavior unless another module says otherwise.
98 HAVE_LOCALTIME_R=1; AC_SUBST([HAVE_LOCALTIME_R]) 98 HAVE_DECL_LOCALTIME_R=1; AC_SUBST([HAVE_DECL_LOCALTIME_R])
99 HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP]) 99 HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP])
100 HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME]) 100 HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME])
101 HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) 101 HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM])
diff --git a/gl/m4/time_r.m4 b/gl/m4/time_r.m4
index 9e82d39..c388a83 100644
--- a/gl/m4/time_r.m4
+++ b/gl/m4/time_r.m4
@@ -1,6 +1,6 @@
1dnl Reentrant time functions: localtime_r, gmtime_r. 1dnl Reentrant time functions: localtime_r, gmtime_r.
2 2
3dnl Copyright (C) 2003, 2006-2010 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2006-2013 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
@@ -15,8 +15,16 @@ AC_DEFUN([gl_TIME_R],
15 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) 15 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
16 AC_REQUIRE([AC_C_RESTRICT]) 16 AC_REQUIRE([AC_C_RESTRICT])
17 17
18 dnl Some systems don't declare localtime_r() and gmtime_r() if _REENTRANT is
19 dnl not defined.
20 AC_CHECK_DECLS([localtime_r], [], [], [[#include <time.h>]])
21 if test $ac_cv_have_decl_localtime_r = no; then
22 HAVE_DECL_LOCALTIME_R=0
23 fi
24
18 AC_CHECK_FUNCS_ONCE([localtime_r]) 25 AC_CHECK_FUNCS_ONCE([localtime_r])
19 if test $ac_cv_func_localtime_r = yes; then 26 if test $ac_cv_func_localtime_r = yes; then
27 HAVE_LOCALTIME_R=1
20 AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature], 28 AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature],
21 [gl_cv_time_r_posix], 29 [gl_cv_time_r_posix],
22 [AC_COMPILE_IFELSE( 30 [AC_COMPILE_IFELSE(
@@ -42,10 +50,6 @@ AC_DEFUN([gl_TIME_R],
42 else 50 else
43 HAVE_LOCALTIME_R=0 51 HAVE_LOCALTIME_R=0
44 fi 52 fi
45 if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
46 AC_LIBOBJ([time_r])
47 gl_PREREQ_TIME_R
48 fi
49]) 53])
50 54
51# Prerequisites of lib/time_r.c. 55# Prerequisites of lib/time_r.c.
diff --git a/gl/m4/timegm.m4 b/gl/m4/timegm.m4
index bdaafbf..997953c 100644
--- a/gl/m4/timegm.m4
+++ b/gl/m4/timegm.m4
@@ -1,5 +1,5 @@
1# timegm.m4 serial 8 1# timegm.m4 serial 11
2dnl Copyright (C) 2003, 2007, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -11,30 +11,16 @@ AC_DEFUN([gl_FUNC_TIMEGM],
11 REPLACE_TIMEGM=0 11 REPLACE_TIMEGM=0
12 AC_CHECK_FUNCS_ONCE([timegm]) 12 AC_CHECK_FUNCS_ONCE([timegm])
13 if test $ac_cv_func_timegm = yes; then 13 if test $ac_cv_func_timegm = yes; then
14 if test $ac_cv_func_working_mktime = no; then 14 if test $gl_cv_func_working_mktime = no; then
15 # Assume that timegm is buggy if mktime is. 15 # Assume that timegm is buggy if mktime is.
16 REPLACE_TIMEGM=1 16 REPLACE_TIMEGM=1
17 fi 17 fi
18 else 18 else
19 HAVE_TIMEGM=0 19 HAVE_TIMEGM=0
20 fi 20 fi
21 if test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1; then
22 AC_LIBOBJ([timegm])
23 gl_PREREQ_TIMEGM
24 fi
25]) 21])
26 22
27# Prerequisites of lib/timegm.c. 23# Prerequisites of lib/timegm.c.
28AC_DEFUN([gl_PREREQ_TIMEGM], [ 24AC_DEFUN([gl_PREREQ_TIMEGM], [
29 AC_REQUIRE([gl_TIME_R]) 25 :
30 AC_REQUIRE([gl_FUNC_MKTIME])
31 if test $ac_cv_func_working_mktime = yes; then
32 AC_CHECK_FUNC([__mktime_internal], ,
33 [# mktime works but it doesn't export __mktime_internal,
34 # so we need to substitute our own mktime implementation.
35 AC_LIBOBJ([mktime])
36 AC_DEFINE([mktime], [rpl_mktime],
37 [Define to rpl_mktime if the replacement function should be used.])
38 gl_PREREQ_MKTIME])
39 fi
40]) 26])
diff --git a/gl/m4/uintmax_t.m4 b/gl/m4/uintmax_t.m4
index 03b51bc..c6ff800 100644
--- a/gl/m4/uintmax_t.m4
+++ b/gl/m4/uintmax_t.m4
@@ -1,5 +1,5 @@
1# uintmax_t.m4 serial 12 1# uintmax_t.m4 serial 12
2dnl Copyright (C) 1997-2004, 2007-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2004, 2007-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
diff --git a/gl/m4/unistd-safer.m4 b/gl/m4/unistd-safer.m4
deleted file mode 100644
index 74c3ce6..0000000
--- a/gl/m4/unistd-safer.m4
+++ /dev/null
@@ -1,13 +0,0 @@
1#serial 8
2dnl Copyright (C) 2002, 2005-2006, 2009-2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_UNISTD_SAFER],
8[
9 AC_CHECK_FUNCS_ONCE([pipe])
10 AC_LIBOBJ([dup-safer])
11 AC_LIBOBJ([fd-safer])
12 AC_LIBOBJ([pipe-safer])
13])
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4
index 48d06c7..32dcfa5 100644
--- a/gl/m4/unistd_h.m4
+++ b/gl/m4/unistd_h.m4
@@ -1,5 +1,5 @@
1# unistd_h.m4 serial 46 1# unistd_h.m4 serial 66
2dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2006-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -11,11 +11,8 @@ AC_DEFUN([gl_UNISTD_H],
11 dnl Use AC_REQUIRE here, so that the default behavior below is expanded 11 dnl Use AC_REQUIRE here, so that the default behavior below is expanded
12 dnl once only, before all statements that occur in other macros. 12 dnl once only, before all statements that occur in other macros.
13 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) 13 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
14 AC_REQUIRE([AC_C_INLINE])
15 14
16 gl_CHECK_NEXT_HEADERS([unistd.h]) 15 gl_CHECK_NEXT_HEADERS([unistd.h])
17
18 AC_CHECK_HEADERS_ONCE([unistd.h])
19 if test $ac_cv_header_unistd_h = yes; then 16 if test $ac_cv_header_unistd_h = yes; then
20 HAVE_UNISTD_H=1 17 HAVE_UNISTD_H=1
21 else 18 else
@@ -23,11 +20,20 @@ AC_DEFUN([gl_UNISTD_H],
23 fi 20 fi
24 AC_SUBST([HAVE_UNISTD_H]) 21 AC_SUBST([HAVE_UNISTD_H])
25 22
23 dnl Ensure the type pid_t gets defined.
24 AC_REQUIRE([AC_TYPE_PID_T])
25
26 dnl Determine WINDOWS_64_BIT_OFF_T.
27 AC_REQUIRE([gl_TYPE_OFF_T])
28
26 dnl Check for declarations of anything we want to poison if the 29 dnl Check for declarations of anything we want to poison if the
27 dnl corresponding gnulib module is not in use. 30 dnl corresponding gnulib module is not in use.
28 gl_WARN_ON_USE_PREPARE([[#include <unistd.h> 31 gl_WARN_ON_USE_PREPARE([[
32#if HAVE_UNISTD_H
33# include <unistd.h>
34#endif
29/* Some systems declare various items in the wrong headers. */ 35/* Some systems declare various items in the wrong headers. */
30#ifndef __GLIBC__ 36#if !(defined __GLIBC__ && !defined __UCLIBC__)
31# include <fcntl.h> 37# include <fcntl.h>
32# include <stdio.h> 38# include <stdio.h>
33# include <stdlib.h> 39# include <stdlib.h>
@@ -35,12 +41,13 @@ AC_DEFUN([gl_UNISTD_H],
35# include <io.h> 41# include <io.h>
36# endif 42# endif
37#endif 43#endif
38 ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat 44 ]], [chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir fchownat
39 fsync ftruncate getcwd getdomainname getdtablesize getgroups 45 fdatasync fsync ftruncate getcwd getdomainname getdtablesize getgroups
40 gethostname getlogin getlogin_r getpagesize getusershell setusershell 46 gethostname getlogin getlogin_r getpagesize
41 endusershell lchown link linkat lseek pipe2 pread pwrite readlink 47 getusershell setusershell endusershell
42 readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat 48 group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite
43 usleep]) 49 readlink readlinkat rmdir sethostname sleep symlink symlinkat ttyname_r
50 unlink unlinkat usleep])
44]) 51])
45 52
46AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], 53AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
@@ -54,46 +61,54 @@ AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
54 61
55AC_DEFUN([gl_UNISTD_H_DEFAULTS], 62AC_DEFUN([gl_UNISTD_H_DEFAULTS],
56[ 63[
57 GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) 64 GNULIB_CHDIR=0; AC_SUBST([GNULIB_CHDIR])
58 GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) 65 GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN])
59 GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) 66 GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE])
60 GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) 67 GNULIB_DUP=0; AC_SUBST([GNULIB_DUP])
61 GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) 68 GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2])
62 GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) 69 GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3])
63 GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) 70 GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON])
64 GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) 71 GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS])
65 GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) 72 GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT])
66 GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) 73 GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR])
67 GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) 74 GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT])
68 GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) 75 GNULIB_FDATASYNC=0; AC_SUBST([GNULIB_FDATASYNC])
69 GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) 76 GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC])
70 GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) 77 GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE])
71 GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS]) 78 GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD])
72 GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) 79 GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME])
73 GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN]) 80 GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE])
74 GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) 81 GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS])
75 GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) 82 GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME])
76 GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) 83 GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN])
77 GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) 84 GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R])
78 GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) 85 GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE])
79 GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) 86 GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL])
80 GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) 87 GNULIB_GROUP_MEMBER=0; AC_SUBST([GNULIB_GROUP_MEMBER])
81 GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2]) 88 GNULIB_ISATTY=0; AC_SUBST([GNULIB_ISATTY])
82 GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD]) 89 GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN])
83 GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE]) 90 GNULIB_LINK=0; AC_SUBST([GNULIB_LINK])
84 GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) 91 GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT])
85 GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT]) 92 GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK])
86 GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR]) 93 GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE])
87 GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) 94 GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2])
88 GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK]) 95 GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD])
89 GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) 96 GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE])
90 GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R]) 97 GNULIB_READ=0; AC_SUBST([GNULIB_READ])
91 GNULIB_UNISTD_H_GETOPT=0; AC_SUBST([GNULIB_UNISTD_H_GETOPT]) 98 GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK])
92 GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) 99 GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT])
93 GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK]) 100 GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR])
94 GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) 101 GNULIB_SETHOSTNAME=0; AC_SUBST([GNULIB_SETHOSTNAME])
95 GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP]) 102 GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP])
96 GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) 103 GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK])
104 GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT])
105 GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R])
106 GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING])
107 GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
108 GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK])
109 GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT])
110 GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP])
111 GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE])
97 dnl Assume proper GNU behavior unless another module says otherwise. 112 dnl Assume proper GNU behavior unless another module says otherwise.
98 HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) 113 HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN])
99 HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) 114 HAVE_DUP2=1; AC_SUBST([HAVE_DUP2])
@@ -102,32 +117,39 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
102 HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) 117 HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT])
103 HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) 118 HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR])
104 HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) 119 HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT])
120 HAVE_FDATASYNC=1; AC_SUBST([HAVE_FDATASYNC])
105 HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) 121 HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC])
106 HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) 122 HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE])
107 HAVE_GETDOMAINNAME=1; AC_SUBST([HAVE_GETDOMAINNAME])
108 HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) 123 HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE])
109 HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS]) 124 HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS])
110 HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) 125 HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME])
111 HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) 126 HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN])
112 HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) 127 HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE])
128 HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER])
113 HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) 129 HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN])
114 HAVE_LINK=1; AC_SUBST([HAVE_LINK]) 130 HAVE_LINK=1; AC_SUBST([HAVE_LINK])
115 HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) 131 HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT])
132 HAVE_PIPE=1; AC_SUBST([HAVE_PIPE])
116 HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2]) 133 HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2])
117 HAVE_PREAD=1; AC_SUBST([HAVE_PREAD]) 134 HAVE_PREAD=1; AC_SUBST([HAVE_PREAD])
118 HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE]) 135 HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE])
119 HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) 136 HAVE_READLINK=1; AC_SUBST([HAVE_READLINK])
120 HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT]) 137 HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT])
138 HAVE_SETHOSTNAME=1; AC_SUBST([HAVE_SETHOSTNAME])
121 HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) 139 HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP])
122 HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK]) 140 HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK])
123 HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT]) 141 HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT])
124 HAVE_TTYNAME_R=1; AC_SUBST([HAVE_TTYNAME_R])
125 HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) 142 HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT])
126 HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) 143 HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP])
127 HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) 144 HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON])
145 HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR])
146 HAVE_DECL_FDATASYNC=1; AC_SUBST([HAVE_DECL_FDATASYNC])
147 HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME])
128 HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) 148 HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
129 HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) 149 HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE])
130 HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) 150 HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL])
151 HAVE_DECL_SETHOSTNAME=1; AC_SUBST([HAVE_DECL_SETHOSTNAME])
152 HAVE_DECL_TTYNAME_R=1; AC_SUBST([HAVE_DECL_TTYNAME_R])
131 HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) 153 HAVE_OS_H=0; AC_SUBST([HAVE_OS_H])
132 HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) 154 HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H])
133 REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) 155 REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN])
@@ -135,15 +157,20 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
135 REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) 157 REPLACE_DUP=0; AC_SUBST([REPLACE_DUP])
136 REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) 158 REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2])
137 REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) 159 REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT])
160 REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE])
138 REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) 161 REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])
162 REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME])
163 REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R])
139 REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) 164 REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS])
140 REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) 165 REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
166 REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY])
141 REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) 167 REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN])
142 REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) 168 REPLACE_LINK=0; AC_SUBST([REPLACE_LINK])
143 REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) 169 REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT])
144 REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) 170 REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK])
145 REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) 171 REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD])
146 REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) 172 REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE])
173 REPLACE_READ=0; AC_SUBST([REPLACE_READ])
147 REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) 174 REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK])
148 REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) 175 REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR])
149 REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) 176 REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP])
diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4
index ebe3c52..d730e43 100644
--- a/gl/m4/vasnprintf.m4
+++ b/gl/m4/vasnprintf.m4
@@ -1,5 +1,5 @@
1# vasnprintf.m4 serial 31 1# vasnprintf.m4 serial 36
2dnl Copyright (C) 2002-2004, 2006-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2004, 2006-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -29,7 +29,7 @@ AC_DEFUN([gl_REPLACE_VASNPRINTF],
29 gl_PREREQ_ASNPRINTF 29 gl_PREREQ_ASNPRINTF
30]) 30])
31 31
32# Prequisites of lib/printf-args.h, lib/printf-args.c. 32# Prerequisites of lib/printf-args.h, lib/printf-args.c.
33AC_DEFUN([gl_PREREQ_PRINTF_ARGS], 33AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
34[ 34[
35 AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) 35 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
@@ -37,9 +37,10 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
37 AC_REQUIRE([gt_TYPE_WINT_T]) 37 AC_REQUIRE([gt_TYPE_WINT_T])
38]) 38])
39 39
40# Prequisites of lib/printf-parse.h, lib/printf-parse.c. 40# Prerequisites of lib/printf-parse.h, lib/printf-parse.c.
41AC_DEFUN([gl_PREREQ_PRINTF_PARSE], 41AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
42[ 42[
43 AC_REQUIRE([gl_FEATURES_H])
43 AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) 44 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
44 AC_REQUIRE([gt_TYPE_WCHAR_T]) 45 AC_REQUIRE([gt_TYPE_WCHAR_T])
45 AC_REQUIRE([gt_TYPE_WINT_T]) 46 AC_REQUIRE([gt_TYPE_WINT_T])
@@ -54,7 +55,6 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
54# Prerequisites of lib/vasnprintf.c. 55# Prerequisites of lib/vasnprintf.c.
55AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], 56AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF],
56[ 57[
57 AC_REQUIRE([AC_C_INLINE])
58 AC_REQUIRE([AC_FUNC_ALLOCA]) 58 AC_REQUIRE([AC_FUNC_ALLOCA])
59 AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) 59 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
60 AC_REQUIRE([gt_TYPE_WCHAR_T]) 60 AC_REQUIRE([gt_TYPE_WCHAR_T])
@@ -62,7 +62,10 @@ AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF],
62 AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) 62 AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb])
63 dnl Use the _snprintf function only if it is declared (because on NetBSD it 63 dnl Use the _snprintf function only if it is declared (because on NetBSD it
64 dnl is defined as a weak alias of snprintf; we prefer to use the latter). 64 dnl is defined as a weak alias of snprintf; we prefer to use the latter).
65 AC_CHECK_DECLS([_snprintf], , , [#include <stdio.h>]) 65 AC_CHECK_DECLS([_snprintf], , , [[#include <stdio.h>]])
66 dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization
67 dnl in the code for NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE.
68 AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION])
66 dnl We can avoid a lot of code by assuming that snprintf's return value 69 dnl We can avoid a lot of code by assuming that snprintf's return value
67 dnl conforms to ISO C99. So check that. 70 dnl conforms to ISO C99. So check that.
68 AC_REQUIRE([gl_SNPRINTF_RETVAL_C99]) 71 AC_REQUIRE([gl_SNPRINTF_RETVAL_C99])
diff --git a/gl/m4/vasprintf.m4 b/gl/m4/vasprintf.m4
index b142bc0..c214ff1 100644
--- a/gl/m4/vasprintf.m4
+++ b/gl/m4/vasprintf.m4
@@ -1,5 +1,5 @@
1# vasprintf.m4 serial 6 1# vasprintf.m4 serial 6
2dnl Copyright (C) 2002-2003, 2006-2007, 2009-2010 Free Software Foundation, 2dnl Copyright (C) 2002-2003, 2006-2007, 2009-2013 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
diff --git a/gl/m4/visibility.m4 b/gl/m4/visibility.m4
index 077c476..6cbd7e5 100644
--- a/gl/m4/visibility.m4
+++ b/gl/m4/visibility.m4
@@ -1,5 +1,5 @@
1# visibility.m4 serial 3 (gettext-0.18) 1# visibility.m4 serial 5 (gettext-0.18.2)
2dnl Copyright (C) 2005, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2005, 2008, 2010-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -12,7 +12,7 @@ dnl __attribute__((__visibility__("hidden"))) and
12dnl __attribute__((__visibility__("default"))). 12dnl __attribute__((__visibility__("default"))).
13dnl Does *not* test for __visibility__("protected") - which has tricky 13dnl Does *not* test for __visibility__("protected") - which has tricky
14dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on 14dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
15dnl MacOS X. 15dnl Mac OS X.
16dnl Does *not* test for __visibility__("internal") - which has processor 16dnl Does *not* test for __visibility__("internal") - which has processor
17dnl dependent semantics. 17dnl dependent semantics.
18dnl Does *not* test for #pragma GCC visibility push(hidden) - which is 18dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
@@ -33,7 +33,8 @@ AC_DEFUN([gl_VISIBILITY],
33 AC_CACHE_VAL([gl_cv_cc_vis_werror], [ 33 AC_CACHE_VAL([gl_cv_cc_vis_werror], [
34 gl_save_CFLAGS="$CFLAGS" 34 gl_save_CFLAGS="$CFLAGS"
35 CFLAGS="$CFLAGS -Werror" 35 CFLAGS="$CFLAGS -Werror"
36 AC_TRY_COMPILE([], [], 36 AC_COMPILE_IFELSE(
37 [AC_LANG_PROGRAM([[]], [[]])],
37 [gl_cv_cc_vis_werror=yes], 38 [gl_cv_cc_vis_werror=yes],
38 [gl_cv_cc_vis_werror=no]) 39 [gl_cv_cc_vis_werror=no])
39 CFLAGS="$gl_save_CFLAGS"]) 40 CFLAGS="$gl_save_CFLAGS"])
@@ -51,13 +52,15 @@ AC_DEFUN([gl_VISIBILITY],
51 if test $gl_cv_cc_vis_werror = yes; then 52 if test $gl_cv_cc_vis_werror = yes; then
52 CFLAGS="$CFLAGS -Werror" 53 CFLAGS="$CFLAGS -Werror"
53 fi 54 fi
54 AC_TRY_COMPILE( 55 AC_COMPILE_IFELSE(
55 [extern __attribute__((__visibility__("hidden"))) int hiddenvar; 56 [AC_LANG_PROGRAM(
56 extern __attribute__((__visibility__("default"))) int exportedvar; 57 [[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
57 extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); 58 extern __attribute__((__visibility__("default"))) int exportedvar;
58 extern __attribute__((__visibility__("default"))) int exportedfunc (void); 59 extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
59 void dummyfunc (void) {}], 60 extern __attribute__((__visibility__("default"))) int exportedfunc (void);
60 [], 61 void dummyfunc (void) {}
62 ]],
63 [[]])],
61 [gl_cv_cc_visibility=yes], 64 [gl_cv_cc_visibility=yes],
62 [gl_cv_cc_visibility=no]) 65 [gl_cv_cc_visibility=no])
63 CFLAGS="$gl_save_CFLAGS"]) 66 CFLAGS="$gl_save_CFLAGS"])
diff --git a/gl/m4/vsnprintf.m4 b/gl/m4/vsnprintf.m4
index ed189c2..4900764 100644
--- a/gl/m4/vsnprintf.m4
+++ b/gl/m4/vsnprintf.m4
@@ -1,9 +1,13 @@
1# vsnprintf.m4 serial 5 1# vsnprintf.m4 serial 6
2dnl Copyright (C) 2002-2004, 2007-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2004, 2007-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7dnl Libintl 0.17 will replace vsnprintf only if it does not support %1$s,
8dnl but defers to any gnulib vsnprintf replacements. Therefore, gnulib
9dnl must guarantee that the decision for replacing vsnprintf is a superset
10dnl of the reasons checked by libintl.
7AC_DEFUN([gl_FUNC_VSNPRINTF], 11AC_DEFUN([gl_FUNC_VSNPRINTF],
8[ 12[
9 AC_REQUIRE([gl_STDIO_H_DEFAULTS]) 13 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
@@ -13,7 +17,17 @@ AC_DEFUN([gl_FUNC_VSNPRINTF],
13 gl_SNPRINTF_SIZE1 17 gl_SNPRINTF_SIZE1
14 case "$gl_cv_func_snprintf_size1" in 18 case "$gl_cv_func_snprintf_size1" in
15 *yes) 19 *yes)
16 gl_cv_func_vsnprintf_usable=yes 20 gl_SNPRINTF_RETVAL_C99
21 case "$gl_cv_func_snprintf_retval_c99" in
22 *yes)
23 gl_PRINTF_POSITIONS
24 case "$gl_cv_func_printf_positions" in
25 *yes)
26 gl_cv_func_vsnprintf_usable=yes
27 ;;
28 esac
29 ;;
30 esac
17 ;; 31 ;;
18 esac 32 esac
19 fi 33 fi
diff --git a/gl/m4/warn-on-use.m4 b/gl/m4/warn-on-use.m4
index 42daae8..e43beeb 100644
--- a/gl/m4/warn-on-use.m4
+++ b/gl/m4/warn-on-use.m4
@@ -1,5 +1,5 @@
1# warn-on-use.m4 serial 2 1# warn-on-use.m4 serial 5
2dnl Copyright (C) 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2010-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -18,8 +18,8 @@ dnl with or without modifications, as long as this notice is preserved.
18# some systems declare functions in the wrong header, then INCLUDES 18# some systems declare functions in the wrong header, then INCLUDES
19# should do likewise. 19# should do likewise.
20# 20#
21# If you assume C89, then it is generally safe to assume declarations 21# It is generally safe to assume declarations for functions declared
22# for functions declared in that standard (such as gets) without 22# in the intersection of C89 and C11 (such as printf) without
23# needing gl_WARN_ON_USE_PREPARE. 23# needing gl_WARN_ON_USE_PREPARE.
24AC_DEFUN([gl_WARN_ON_USE_PREPARE], 24AC_DEFUN([gl_WARN_ON_USE_PREPARE],
25[ 25[
@@ -27,6 +27,8 @@ AC_DEFUN([gl_WARN_ON_USE_PREPARE],
27 [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), 27 [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])),
28 [Define to 1 if ]m4_defn([gl_decl])[ is declared even after 28 [Define to 1 if ]m4_defn([gl_decl])[ is declared even after
29 undefining macros.])])dnl 29 undefining macros.])])dnl
30dnl FIXME: gl_Symbol must be used unquoted until we can assume
31dnl autoconf 2.64 or newer.
30 for gl_func in m4_flatten([$2]); do 32 for gl_func in m4_flatten([$2]); do
31 AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl 33 AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl
32 AC_CACHE_CHECK([whether $gl_func is declared without a macro], 34 AC_CACHE_CHECK([whether $gl_func is declared without a macro],
@@ -35,8 +37,8 @@ AC_DEFUN([gl_WARN_ON_USE_PREPARE],
35[@%:@undef $gl_func 37[@%:@undef $gl_func
36 (void) $gl_func;])], 38 (void) $gl_func;])],
37 [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])]) 39 [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])])
38 AS_VAR_IF(gl_Symbol, [yes], 40 AS_VAR_IF(gl_Symbol, [yes],
39 [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) 41 [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1])
40 dnl shortcut - if the raw declaration exists, then set a cache 42 dnl shortcut - if the raw declaration exists, then set a cache
41 dnl variable to allow skipping any later AC_CHECK_DECL efforts 43 dnl variable to allow skipping any later AC_CHECK_DECL efforts
42 eval ac_cv_have_decl_$gl_func=yes]) 44 eval ac_cv_have_decl_$gl_func=yes])
diff --git a/gl/m4/wchar_h.m4 b/gl/m4/wchar_h.m4
index 8cae82d..bedb15a 100644
--- a/gl/m4/wchar_h.m4
+++ b/gl/m4/wchar_h.m4
@@ -1,13 +1,13 @@
1dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. 1dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
2 2
3dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2013 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7 7
8dnl Written by Eric Blake. 8dnl Written by Eric Blake.
9 9
10# wchar_h.m4 serial 33 10# wchar_h.m4 serial 39
11 11
12AC_DEFUN([gl_WCHAR_H], 12AC_DEFUN([gl_WCHAR_H],
13[ 13[
@@ -17,7 +17,6 @@ AC_DEFUN([gl_WCHAR_H],
17 dnl Check for <wchar.h> (missing in Linux uClibc when built without wide 17 dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
18 dnl character support). 18 dnl character support).
19 dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK. 19 dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK.
20 AC_CHECK_HEADERS_ONCE([wchar.h])
21 gl_CHECK_NEXT_HEADERS([wchar.h]) 20 gl_CHECK_NEXT_HEADERS([wchar.h])
22 if test $ac_cv_header_wchar_h = yes; then 21 if test $ac_cv_header_wchar_h = yes; then
23 HAVE_WCHAR_H=1 22 HAVE_WCHAR_H=1
@@ -26,6 +25,8 @@ AC_DEFUN([gl_WCHAR_H],
26 fi 25 fi
27 AC_SUBST([HAVE_WCHAR_H]) 26 AC_SUBST([HAVE_WCHAR_H])
28 27
28 AC_REQUIRE([gl_FEATURES_H])
29
29 AC_REQUIRE([gt_TYPE_WINT_T]) 30 AC_REQUIRE([gt_TYPE_WINT_T])
30 if test $gt_cv_c_wint_t = yes; then 31 if test $gt_cv_c_wint_t = yes; then
31 HAVE_WINT_T=1 32 HAVE_WINT_T=1
@@ -37,15 +38,23 @@ AC_DEFUN([gl_WCHAR_H],
37 dnl Check for declarations of anything we want to poison if the 38 dnl Check for declarations of anything we want to poison if the
38 dnl corresponding gnulib module is not in use. 39 dnl corresponding gnulib module is not in use.
39 gl_WARN_ON_USE_PREPARE([[ 40 gl_WARN_ON_USE_PREPARE([[
40/* Some systems require additional headers. */ 41/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
41#ifndef __GLIBC__ 42 <wchar.h>.
43 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
44 included before <wchar.h>. */
45#if !(defined __GLIBC__ && !defined __UCLIBC__)
42# include <stddef.h> 46# include <stddef.h>
43# include <stdio.h> 47# include <stdio.h>
44# include <time.h> 48# include <time.h>
45#endif 49#endif
46#include <wchar.h> 50#include <wchar.h>
47 ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb 51 ]],
48 wcsrtombs wcsnrtombs wcwidth]) 52 [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb
53 wcsrtombs wcsnrtombs wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset
54 wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp
55 wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr
56 wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth
57 ])
49]) 58])
50 59
51dnl Check whether <wchar.h> is usable at all. 60dnl Check whether <wchar.h> is usable at all.
@@ -61,6 +70,13 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK],
61 [gl_cv_header_wchar_h_correct_inline=yes 70 [gl_cv_header_wchar_h_correct_inline=yes
62 AC_LANG_CONFTEST([ 71 AC_LANG_CONFTEST([
63 AC_LANG_SOURCE([[#define wcstod renamed_wcstod 72 AC_LANG_SOURCE([[#define wcstod renamed_wcstod
73/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
74 <wchar.h>.
75 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
76 included before <wchar.h>. */
77#include <stddef.h>
78#include <stdio.h>
79#include <time.h>
64#include <wchar.h> 80#include <wchar.h>
65extern int zero (void); 81extern int zero (void);
66int main () { return zero(); } 82int main () { return zero(); }
@@ -69,6 +85,13 @@ int main () { return zero(); }
69 mv conftest.$ac_objext conftest1.$ac_objext 85 mv conftest.$ac_objext conftest1.$ac_objext
70 AC_LANG_CONFTEST([ 86 AC_LANG_CONFTEST([
71 AC_LANG_SOURCE([[#define wcstod renamed_wcstod 87 AC_LANG_SOURCE([[#define wcstod renamed_wcstod
88/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
89 <wchar.h>.
90 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
91 included before <wchar.h>. */
92#include <stddef.h>
93#include <stdio.h>
94#include <time.h>
72#include <wchar.h> 95#include <wchar.h>
73int zero (void) { return 0; } 96int zero (void) { return 0; }
74]])]) 97]])])
@@ -96,13 +119,6 @@ Configuration aborted.])
96 fi 119 fi
97]) 120])
98 121
99dnl Unconditionally enables the replacement of <wchar.h>.
100AC_DEFUN([gl_REPLACE_WCHAR_H],
101[
102 dnl This is a no-op, because <wchar.h> is always overridden.
103 :
104])
105
106AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], 122AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
107[ 123[
108 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 124 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
@@ -114,17 +130,45 @@ AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
114 130
115AC_DEFUN([gl_WCHAR_H_DEFAULTS], 131AC_DEFUN([gl_WCHAR_H_DEFAULTS],
116[ 132[
117 GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC]) 133 GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC])
118 GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB]) 134 GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB])
119 GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT]) 135 GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT])
120 GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC]) 136 GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC])
121 GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN]) 137 GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN])
122 GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS]) 138 GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS])
123 GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS]) 139 GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS])
124 GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB]) 140 GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB])
125 GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS]) 141 GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS])
126 GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS]) 142 GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS])
127 GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) 143 GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
144 GNULIB_WMEMCHR=0; AC_SUBST([GNULIB_WMEMCHR])
145 GNULIB_WMEMCMP=0; AC_SUBST([GNULIB_WMEMCMP])
146 GNULIB_WMEMCPY=0; AC_SUBST([GNULIB_WMEMCPY])
147 GNULIB_WMEMMOVE=0; AC_SUBST([GNULIB_WMEMMOVE])
148 GNULIB_WMEMSET=0; AC_SUBST([GNULIB_WMEMSET])
149 GNULIB_WCSLEN=0; AC_SUBST([GNULIB_WCSLEN])
150 GNULIB_WCSNLEN=0; AC_SUBST([GNULIB_WCSNLEN])
151 GNULIB_WCSCPY=0; AC_SUBST([GNULIB_WCSCPY])
152 GNULIB_WCPCPY=0; AC_SUBST([GNULIB_WCPCPY])
153 GNULIB_WCSNCPY=0; AC_SUBST([GNULIB_WCSNCPY])
154 GNULIB_WCPNCPY=0; AC_SUBST([GNULIB_WCPNCPY])
155 GNULIB_WCSCAT=0; AC_SUBST([GNULIB_WCSCAT])
156 GNULIB_WCSNCAT=0; AC_SUBST([GNULIB_WCSNCAT])
157 GNULIB_WCSCMP=0; AC_SUBST([GNULIB_WCSCMP])
158 GNULIB_WCSNCMP=0; AC_SUBST([GNULIB_WCSNCMP])
159 GNULIB_WCSCASECMP=0; AC_SUBST([GNULIB_WCSCASECMP])
160 GNULIB_WCSNCASECMP=0; AC_SUBST([GNULIB_WCSNCASECMP])
161 GNULIB_WCSCOLL=0; AC_SUBST([GNULIB_WCSCOLL])
162 GNULIB_WCSXFRM=0; AC_SUBST([GNULIB_WCSXFRM])
163 GNULIB_WCSDUP=0; AC_SUBST([GNULIB_WCSDUP])
164 GNULIB_WCSCHR=0; AC_SUBST([GNULIB_WCSCHR])
165 GNULIB_WCSRCHR=0; AC_SUBST([GNULIB_WCSRCHR])
166 GNULIB_WCSCSPN=0; AC_SUBST([GNULIB_WCSCSPN])
167 GNULIB_WCSSPN=0; AC_SUBST([GNULIB_WCSSPN])
168 GNULIB_WCSPBRK=0; AC_SUBST([GNULIB_WCSPBRK])
169 GNULIB_WCSSTR=0; AC_SUBST([GNULIB_WCSSTR])
170 GNULIB_WCSTOK=0; AC_SUBST([GNULIB_WCSTOK])
171 GNULIB_WCSWIDTH=0; AC_SUBST([GNULIB_WCSWIDTH])
128 dnl Assume proper GNU behavior unless another module says otherwise. 172 dnl Assume proper GNU behavior unless another module says otherwise.
129 HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) 173 HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC])
130 HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) 174 HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT])
@@ -135,6 +179,34 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
135 HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB]) 179 HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB])
136 HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS]) 180 HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS])
137 HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS]) 181 HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS])
182 HAVE_WMEMCHR=1; AC_SUBST([HAVE_WMEMCHR])
183 HAVE_WMEMCMP=1; AC_SUBST([HAVE_WMEMCMP])
184 HAVE_WMEMCPY=1; AC_SUBST([HAVE_WMEMCPY])
185 HAVE_WMEMMOVE=1; AC_SUBST([HAVE_WMEMMOVE])
186 HAVE_WMEMSET=1; AC_SUBST([HAVE_WMEMSET])
187 HAVE_WCSLEN=1; AC_SUBST([HAVE_WCSLEN])
188 HAVE_WCSNLEN=1; AC_SUBST([HAVE_WCSNLEN])
189 HAVE_WCSCPY=1; AC_SUBST([HAVE_WCSCPY])
190 HAVE_WCPCPY=1; AC_SUBST([HAVE_WCPCPY])
191 HAVE_WCSNCPY=1; AC_SUBST([HAVE_WCSNCPY])
192 HAVE_WCPNCPY=1; AC_SUBST([HAVE_WCPNCPY])
193 HAVE_WCSCAT=1; AC_SUBST([HAVE_WCSCAT])
194 HAVE_WCSNCAT=1; AC_SUBST([HAVE_WCSNCAT])
195 HAVE_WCSCMP=1; AC_SUBST([HAVE_WCSCMP])
196 HAVE_WCSNCMP=1; AC_SUBST([HAVE_WCSNCMP])
197 HAVE_WCSCASECMP=1; AC_SUBST([HAVE_WCSCASECMP])
198 HAVE_WCSNCASECMP=1; AC_SUBST([HAVE_WCSNCASECMP])
199 HAVE_WCSCOLL=1; AC_SUBST([HAVE_WCSCOLL])
200 HAVE_WCSXFRM=1; AC_SUBST([HAVE_WCSXFRM])
201 HAVE_WCSDUP=1; AC_SUBST([HAVE_WCSDUP])
202 HAVE_WCSCHR=1; AC_SUBST([HAVE_WCSCHR])
203 HAVE_WCSRCHR=1; AC_SUBST([HAVE_WCSRCHR])
204 HAVE_WCSCSPN=1; AC_SUBST([HAVE_WCSCSPN])
205 HAVE_WCSSPN=1; AC_SUBST([HAVE_WCSSPN])
206 HAVE_WCSPBRK=1; AC_SUBST([HAVE_WCSPBRK])
207 HAVE_WCSSTR=1; AC_SUBST([HAVE_WCSSTR])
208 HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK])
209 HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH])
138 HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) 210 HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB])
139 HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) 211 HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
140 REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) 212 REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T])
@@ -149,4 +221,5 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
149 REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS]) 221 REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS])
150 REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS]) 222 REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS])
151 REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) 223 REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
224 REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH])
152]) 225])
diff --git a/gl/m4/wchar_t.m4 b/gl/m4/wchar_t.m4
index ed804e6..e1e1e69 100644
--- a/gl/m4/wchar_t.m4
+++ b/gl/m4/wchar_t.m4
@@ -1,5 +1,5 @@
1# wchar_t.m4 serial 3 (gettext-0.18) 1# wchar_t.m4 serial 4 (gettext-0.18.2)
2dnl Copyright (C) 2002-2003, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2003, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -11,9 +11,13 @@ dnl Prerequisite: AC_PROG_CC
11AC_DEFUN([gt_TYPE_WCHAR_T], 11AC_DEFUN([gt_TYPE_WCHAR_T],
12[ 12[
13 AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], 13 AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
14 [AC_TRY_COMPILE([#include <stddef.h> 14 [AC_COMPILE_IFELSE(
15 wchar_t foo = (wchar_t)'\0';], , 15 [AC_LANG_PROGRAM(
16 [gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])]) 16 [[#include <stddef.h>
17 wchar_t foo = (wchar_t)'\0';]],
18 [[]])],
19 [gt_cv_c_wchar_t=yes],
20 [gt_cv_c_wchar_t=no])])
17 if test $gt_cv_c_wchar_t = yes; then 21 if test $gt_cv_c_wchar_t = yes; then
18 AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.]) 22 AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
19 fi 23 fi
diff --git a/gl/m4/wcrtomb.m4 b/gl/m4/wcrtomb.m4
index 6a2d772..f56b5ba 100644
--- a/gl/m4/wcrtomb.m4
+++ b/gl/m4/wcrtomb.m4
@@ -1,5 +1,5 @@
1# wcrtomb.m4 serial 5 1# wcrtomb.m4 serial 11
2dnl Copyright (C) 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -14,6 +14,22 @@ AC_DEFUN([gl_FUNC_WCRTOMB],
14 AC_CHECK_FUNCS_ONCE([wcrtomb]) 14 AC_CHECK_FUNCS_ONCE([wcrtomb])
15 if test $ac_cv_func_wcrtomb = no; then 15 if test $ac_cv_func_wcrtomb = no; then
16 HAVE_WCRTOMB=0 16 HAVE_WCRTOMB=0
17 AC_CHECK_DECLS([wcrtomb],,, [[
18/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
19 <wchar.h>.
20 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
21 included before <wchar.h>. */
22#include <stddef.h>
23#include <stdio.h>
24#include <time.h>
25#include <wchar.h>
26]])
27 if test $ac_cv_have_decl_wcrtomb = yes; then
28 dnl On Minix 3.1.8, the system's <wchar.h> declares wcrtomb() although
29 dnl it does not have the function. Avoid a collision with gnulib's
30 dnl replacement.
31 REPLACE_WCRTOMB=1
32 fi
17 else 33 else
18 if test $REPLACE_MBSTATE_T = 1; then 34 if test $REPLACE_MBSTATE_T = 1; then
19 REPLACE_WCRTOMB=1 35 REPLACE_WCRTOMB=1
@@ -40,35 +56,43 @@ changequote(,)dnl
40 esac 56 esac
41changequote([,])dnl 57changequote([,])dnl
42 if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then 58 if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then
43 AC_TRY_RUN([ 59 AC_RUN_IFELSE(
60 [AC_LANG_SOURCE([[
44#include <locale.h> 61#include <locale.h>
45#include <stdio.h>
46#include <string.h> 62#include <string.h>
63/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
64 <wchar.h>.
65 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
66 included before <wchar.h>. */
67#include <stddef.h>
68#include <stdio.h>
69#include <time.h>
47#include <wchar.h> 70#include <wchar.h>
48int main () 71int main ()
49{ 72{
73 int result = 0;
50 if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) 74 if (setlocale (LC_ALL, "$LOCALE_FR") != NULL)
51 { 75 {
52 if (wcrtomb (NULL, 0, NULL) != 1) 76 if (wcrtomb (NULL, 0, NULL) != 1)
53 return 1; 77 result |= 1;
54 } 78 }
55 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 79 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
56 { 80 {
57 if (wcrtomb (NULL, 0, NULL) != 1) 81 if (wcrtomb (NULL, 0, NULL) != 1)
58 return 1; 82 result |= 2;
59 } 83 }
60 if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) 84 if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
61 { 85 {
62 if (wcrtomb (NULL, 0, NULL) != 1) 86 if (wcrtomb (NULL, 0, NULL) != 1)
63 return 1; 87 result |= 4;
64 } 88 }
65 if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) 89 if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
66 { 90 {
67 if (wcrtomb (NULL, 0, NULL) != 1) 91 if (wcrtomb (NULL, 0, NULL) != 1)
68 return 1; 92 result |= 8;
69 } 93 }
70 return 0; 94 return result;
71}], 95}]])],
72 [gl_cv_func_wcrtomb_retval=yes], 96 [gl_cv_func_wcrtomb_retval=yes],
73 [gl_cv_func_wcrtomb_retval=no], 97 [gl_cv_func_wcrtomb_retval=no],
74 [:]) 98 [:])
@@ -80,11 +104,6 @@ int main ()
80 esac 104 esac
81 fi 105 fi
82 fi 106 fi
83 if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then
84 gl_REPLACE_WCHAR_H
85 AC_LIBOBJ([wcrtomb])
86 gl_PREREQ_WCRTOMB
87 fi
88]) 107])
89 108
90# Prerequisites of lib/wcrtomb.c. 109# Prerequisites of lib/wcrtomb.c.
diff --git a/gl/m4/wctype_h.m4 b/gl/m4/wctype_h.m4
index 3292451..82ada0e 100644
--- a/gl/m4/wctype_h.m4
+++ b/gl/m4/wctype_h.m4
@@ -1,8 +1,8 @@
1# wctype_h.m4 serial 6 1# wctype_h.m4 serial 18
2 2
3dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. 3dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
4 4
5dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. 5dnl Copyright (C) 2006-2013 Free Software Foundation, Inc.
6dnl This file is free software; the Free Software Foundation 6dnl This file is free software; the Free Software Foundation
7dnl gives unlimited permission to copy and/or distribute it, 7dnl gives unlimited permission to copy and/or distribute it,
8dnl with or without modifications, as long as this notice is preserved. 8dnl with or without modifications, as long as this notice is preserved.
@@ -11,6 +11,7 @@ dnl Written by Paul Eggert.
11 11
12AC_DEFUN([gl_WCTYPE_H], 12AC_DEFUN([gl_WCTYPE_H],
13[ 13[
14 AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
14 AC_REQUIRE([AC_PROG_CC]) 15 AC_REQUIRE([AC_PROG_CC])
15 AC_REQUIRE([AC_CANONICAL_HOST]) 16 AC_REQUIRE([AC_CANONICAL_HOST])
16 AC_CHECK_FUNCS_ONCE([iswcntrl]) 17 AC_CHECK_FUNCS_ONCE([iswcntrl])
@@ -20,15 +21,6 @@ AC_DEFUN([gl_WCTYPE_H],
20 HAVE_ISWCNTRL=0 21 HAVE_ISWCNTRL=0
21 fi 22 fi
22 AC_SUBST([HAVE_ISWCNTRL]) 23 AC_SUBST([HAVE_ISWCNTRL])
23 AC_CHECK_FUNCS_ONCE([iswblank])
24 if test $ac_cv_func_iswblank = yes; then
25 HAVE_ISWBLANK=1
26 else
27 HAVE_ISWBLANK=0
28 fi
29 AC_SUBST([HAVE_ISWBLANK])
30 AC_CHECK_HEADERS_ONCE([wctype.h])
31 AC_REQUIRE([AC_C_INLINE])
32 24
33 AC_REQUIRE([gt_TYPE_WINT_T]) 25 AC_REQUIRE([gt_TYPE_WINT_T])
34 if test $gt_cv_c_wint_t = yes; then 26 if test $gt_cv_c_wint_t = yes; then
@@ -38,39 +30,180 @@ AC_DEFUN([gl_WCTYPE_H],
38 fi 30 fi
39 AC_SUBST([HAVE_WINT_T]) 31 AC_SUBST([HAVE_WINT_T])
40 32
33 gl_CHECK_NEXT_HEADERS([wctype.h])
41 if test $ac_cv_header_wctype_h = yes; then 34 if test $ac_cv_header_wctype_h = yes; then
42 if test $ac_cv_func_iswcntrl = yes; then 35 if test $ac_cv_func_iswcntrl = yes; then
43 dnl Linux libc5 has an iswprint function that returns 0 for all arguments. 36 dnl Linux libc5 has an iswprint function that returns 0 for all arguments.
44 dnl The other functions are likely broken in the same way. 37 dnl The other functions are likely broken in the same way.
45 AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works], 38 AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works],
46 [ 39 [
47 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 40 AC_RUN_IFELSE(
48 #include <stddef.h> 41 [AC_LANG_SOURCE([[
49 #include <stdio.h> 42 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be
50 #include <time.h> 43 included before <wchar.h>.
51 #include <wchar.h> 44 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h>
52 #include <wctype.h> 45 must be included before <wchar.h>. */
53 int main () { return iswprint ('x') == 0; }]])], 46 #include <stddef.h>
47 #include <stdio.h>
48 #include <time.h>
49 #include <wchar.h>
50 #include <wctype.h>
51 int main () { return iswprint ('x') == 0; }
52 ]])],
54 [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no], 53 [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no],
55 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> 54 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
56 #if __GNU_LIBRARY__ == 1 55 #if __GNU_LIBRARY__ == 1
57 Linux libc5 i18n is broken. 56 Linux libc5 i18n is broken.
58 #endif]], [])], 57 #endif]], [])],
59 [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no]) 58 [gl_cv_func_iswcntrl_works="guessing yes"],
59 [gl_cv_func_iswcntrl_works="guessing no"])
60 ]) 60 ])
61 ]) 61 ])
62 fi 62 fi
63 gl_CHECK_NEXT_HEADERS([wctype.h])
64 HAVE_WCTYPE_H=1 63 HAVE_WCTYPE_H=1
65 else 64 else
66 HAVE_WCTYPE_H=0 65 HAVE_WCTYPE_H=0
67 fi 66 fi
68 AC_SUBST([HAVE_WCTYPE_H]) 67 AC_SUBST([HAVE_WCTYPE_H])
69 68
70 if test "$gl_cv_func_iswcntrl_works" = no; then 69 case "$gl_cv_func_iswcntrl_works" in
71 REPLACE_ISWCNTRL=1 70 *yes) REPLACE_ISWCNTRL=0 ;;
71 *) REPLACE_ISWCNTRL=1 ;;
72 esac
73 AC_SUBST([REPLACE_ISWCNTRL])
74
75 if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then
76 dnl Redefine all of iswcntrl, ..., iswxdigit in <wctype.h>.
77 :
78 fi
79
80 if test $REPLACE_ISWCNTRL = 1; then
81 REPLACE_TOWLOWER=1
72 else 82 else
73 REPLACE_ISWCNTRL=0 83 AC_CHECK_FUNCS([towlower])
84 if test $ac_cv_func_towlower = yes; then
85 REPLACE_TOWLOWER=0
86 else
87 AC_CHECK_DECLS([towlower],,,
88 [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be
89 included before <wchar.h>.
90 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h>
91 must be included before <wchar.h>. */
92 #include <stddef.h>
93 #include <stdio.h>
94 #include <time.h>
95 #include <wchar.h>
96 #if HAVE_WCTYPE_H
97 # include <wctype.h>
98 #endif
99 ]])
100 if test $ac_cv_have_decl_towlower = yes; then
101 dnl On Minix 3.1.8, the system's <wctype.h> declares towlower() and
102 dnl towupper() although it does not have the functions. Avoid a
103 dnl collision with gnulib's replacement.
104 REPLACE_TOWLOWER=1
105 else
106 REPLACE_TOWLOWER=0
107 fi
108 fi
74 fi 109 fi
75 AC_SUBST([REPLACE_ISWCNTRL]) 110 AC_SUBST([REPLACE_TOWLOWER])
111
112 if test $HAVE_ISWCNTRL = 0 || test $REPLACE_TOWLOWER = 1; then
113 dnl Redefine towlower, towupper in <wctype.h>.
114 :
115 fi
116
117 dnl We assume that the wctype() and iswctype() functions exist if and only
118 dnl if the type wctype_t is defined in <wchar.h> or in <wctype.h> if that
119 dnl exists.
120 dnl HP-UX 11.00 declares all these in <wchar.h> and lacks <wctype.h>.
121 AC_CACHE_CHECK([for wctype_t], [gl_cv_type_wctype_t],
122 [AC_COMPILE_IFELSE(
123 [AC_LANG_PROGRAM(
124 [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be
125 included before <wchar.h>.
126 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h>
127 must be included before <wchar.h>. */
128 #include <stddef.h>
129 #include <stdio.h>
130 #include <time.h>
131 #include <wchar.h>
132 #if HAVE_WCTYPE_H
133 # include <wctype.h>
134 #endif
135 wctype_t a;
136 ]],
137 [[]])],
138 [gl_cv_type_wctype_t=yes],
139 [gl_cv_type_wctype_t=no])
140 ])
141 if test $gl_cv_type_wctype_t = no; then
142 HAVE_WCTYPE_T=0
143 fi
144
145 dnl We assume that the wctrans() and towctrans() functions exist if and only
146 dnl if the type wctrans_t is defined in <wctype.h>.
147 AC_CACHE_CHECK([for wctrans_t], [gl_cv_type_wctrans_t],
148 [AC_COMPILE_IFELSE(
149 [AC_LANG_PROGRAM(
150 [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be
151 included before <wchar.h>.
152 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h>
153 must be included before <wchar.h>. */
154 #include <stddef.h>
155 #include <stdio.h>
156 #include <time.h>
157 #include <wchar.h>
158 #include <wctype.h>
159 wctrans_t a;
160 ]],
161 [[]])],
162 [gl_cv_type_wctrans_t=yes],
163 [gl_cv_type_wctrans_t=no])
164 ])
165 if test $gl_cv_type_wctrans_t = no; then
166 HAVE_WCTRANS_T=0
167 fi
168
169 dnl Check for declarations of anything we want to poison if the
170 dnl corresponding gnulib module is not in use.
171 gl_WARN_ON_USE_PREPARE([[
172/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
173 <wchar.h>.
174 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
175 included before <wchar.h>. */
176#if !(defined __GLIBC__ && !defined __UCLIBC__)
177# include <stddef.h>
178# include <stdio.h>
179# include <time.h>
180# include <wchar.h>
181#endif
182#include <wctype.h>
183 ]],
184 [wctype iswctype wctrans towctrans
185 ])
186])
187
188AC_DEFUN([gl_WCTYPE_MODULE_INDICATOR],
189[
190 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
191 AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
192 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
193 dnl Define it also as a C macro, for the benefit of the unit tests.
194 gl_MODULE_INDICATOR_FOR_TESTS([$1])
195])
196
197AC_DEFUN([gl_WCTYPE_H_DEFAULTS],
198[
199 GNULIB_ISWBLANK=0; AC_SUBST([GNULIB_ISWBLANK])
200 GNULIB_WCTYPE=0; AC_SUBST([GNULIB_WCTYPE])
201 GNULIB_ISWCTYPE=0; AC_SUBST([GNULIB_ISWCTYPE])
202 GNULIB_WCTRANS=0; AC_SUBST([GNULIB_WCTRANS])
203 GNULIB_TOWCTRANS=0; AC_SUBST([GNULIB_TOWCTRANS])
204 dnl Assume proper GNU behavior unless another module says otherwise.
205 HAVE_ISWBLANK=1; AC_SUBST([HAVE_ISWBLANK])
206 HAVE_WCTYPE_T=1; AC_SUBST([HAVE_WCTYPE_T])
207 HAVE_WCTRANS_T=1; AC_SUBST([HAVE_WCTRANS_T])
208 REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK])
76]) 209])
diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4
index a6c7d15..d7cd3db 100644
--- a/gl/m4/wint_t.m4
+++ b/gl/m4/wint_t.m4
@@ -1,5 +1,5 @@
1# wint_t.m4 serial 4 (gettext-0.18) 1# wint_t.m4 serial 5 (gettext-0.18.2)
2dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -11,7 +11,9 @@ dnl Prerequisite: AC_PROG_CC
11AC_DEFUN([gt_TYPE_WINT_T], 11AC_DEFUN([gt_TYPE_WINT_T],
12[ 12[
13 AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], 13 AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
14 [AC_TRY_COMPILE([ 14 [AC_COMPILE_IFELSE(
15 [AC_LANG_PROGRAM(
16 [[
15/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before 17/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
16 <wchar.h>. 18 <wchar.h>.
17 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included 19 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],
20#include <stdio.h> 22#include <stdio.h>
21#include <time.h> 23#include <time.h>
22#include <wchar.h> 24#include <wchar.h>
23 wint_t foo = (wchar_t)'\0';], , 25 wint_t foo = (wchar_t)'\0';]],
24 [gt_cv_c_wint_t=yes], [gt_cv_c_wint_t=no])]) 26 [[]])],
27 [gt_cv_c_wint_t=yes],
28 [gt_cv_c_wint_t=no])])
25 if test $gt_cv_c_wint_t = yes; then 29 if test $gt_cv_c_wint_t = yes; then
26 AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.]) 30 AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
27 fi 31 fi
diff --git a/gl/m4/write.m4 b/gl/m4/write.m4
deleted file mode 100644
index 56325ab..0000000
--- a/gl/m4/write.m4
+++ /dev/null
@@ -1,20 +0,0 @@
1# write.m4 serial 1
2dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_WRITE],
8[
9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
10 dnl This ifdef is just an optimization, to avoid performing a configure
11 dnl check whose result is not used. It does not make the test of
12 dnl GNULIB_UNISTD_H_SIGPIPE or GNULIB_SIGPIPE redundant.
13 m4_ifdef([gl_SIGNAL_SIGPIPE], [
14 gl_SIGNAL_SIGPIPE
15 if test $gl_cv_header_signal_h_SIGPIPE != yes; then
16 REPLACE_WRITE=1
17 AC_LIBOBJ([write])
18 fi
19 ])
20])
diff --git a/gl/m4/xalloc.m4 b/gl/m4/xalloc.m4
index 83247fe..64ca701 100644
--- a/gl/m4/xalloc.m4
+++ b/gl/m4/xalloc.m4
@@ -1,25 +1,7 @@
1# xalloc.m4 serial 16 1# xalloc.m4 serial 18
2dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2009, 2010 Free Software 2dnl Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc.
3dnl Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
7 6
8AC_DEFUN([gl_XALLOC], 7AC_DEFUN([gl_XALLOC], [:])
9[
10 AC_LIBOBJ([xmalloc])
11
12 gl_PREREQ_XALLOC
13 gl_PREREQ_XMALLOC
14])
15
16# Prerequisites of lib/xalloc.h.
17AC_DEFUN([gl_PREREQ_XALLOC], [
18 AC_REQUIRE([gl_INLINE])
19 :
20])
21
22# Prerequisites of lib/xmalloc.c.
23AC_DEFUN([gl_PREREQ_XMALLOC], [
24 :
25])
diff --git a/gl/m4/xsize.m4 b/gl/m4/xsize.m4
index b653693..8ea9f2c 100644
--- a/gl/m4/xsize.m4
+++ b/gl/m4/xsize.m4
@@ -1,5 +1,5 @@
1# xsize.m4 serial 4 1# xsize.m4 serial 5
2dnl Copyright (C) 2003-2004, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2003-2004, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -8,6 +8,5 @@ AC_DEFUN([gl_XSIZE],
8[ 8[
9 dnl Prerequisites of lib/xsize.h. 9 dnl Prerequisites of lib/xsize.h.
10 AC_REQUIRE([gl_SIZE_MAX]) 10 AC_REQUIRE([gl_SIZE_MAX])
11 AC_REQUIRE([AC_C_INLINE])
12 AC_CHECK_HEADERS([stdint.h]) 11 AC_CHECK_HEADERS([stdint.h])
13]) 12])
diff --git a/gl/m4/xstrndup.m4 b/gl/m4/xstrndup.m4
index 74302cc..4a9330b 100644
--- a/gl/m4/xstrndup.m4
+++ b/gl/m4/xstrndup.m4
@@ -1,5 +1,5 @@
1# xstrndup.m4 serial 2 1# xstrndup.m4 serial 2
2dnl Copyright (C) 2003, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.