summaryrefslogtreecommitdiffstats
path: root/gl/m4
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2010-04-08 01:11:46 (GMT)
committerThomas Guyot-Sionnest <dermoth@aei.ca>2010-04-13 01:26:35 (GMT)
commit74da141e618ef99959d509cb2e7be35a348a39db (patch)
tree88ebc38b381a1021fc2d74864a71e230ae591c3d /gl/m4
parentc63a4f726a0b6ad8cf6040f947754a81fd4683bb (diff)
downloadmonitoring-plugins-74da141e618ef99959d509cb2e7be35a348a39db.tar.gz
Sync with the latest Gnulib code (177f525)
Signed-off-by: Thomas Guyot-Sionnest <dermoth@aei.ca>
Diffstat (limited to 'gl/m4')
-rw-r--r--gl/m4/00gnulib.m42
-rw-r--r--gl/m4/alloca.m43
-rw-r--r--gl/m4/arpa_inet_h.m425
-rw-r--r--gl/m4/base64.m42
-rw-r--r--gl/m4/btowc.m445
-rw-r--r--gl/m4/c-strtod.m424
-rw-r--r--gl/m4/cloexec.m42
-rw-r--r--gl/m4/codeset.m42
-rw-r--r--gl/m4/dirname.m414
-rw-r--r--gl/m4/dos.m434
-rw-r--r--gl/m4/double-slash-root.m442
-rw-r--r--gl/m4/dup2.m458
-rw-r--r--gl/m4/errno_h.m47
-rw-r--r--gl/m4/error.m46
-rw-r--r--gl/m4/exitfail.m413
-rw-r--r--gl/m4/extensions.m422
-rw-r--r--gl/m4/fcntl-o.m481
-rw-r--r--gl/m4/fcntl-safer.m412
-rw-r--r--gl/m4/fcntl.m483
-rw-r--r--gl/m4/fcntl_h.m493
-rw-r--r--gl/m4/float_h.m42
-rw-r--r--gl/m4/floorf.m49
-rw-r--r--gl/m4/fstypename.m43
-rw-r--r--gl/m4/fsusage.m485
-rw-r--r--gl/m4/getaddrinfo.m425
-rw-r--r--gl/m4/getdtablesize.m415
-rw-r--r--gl/m4/gethostname.m490
-rw-r--r--gl/m4/getloadavg.m445
-rw-r--r--gl/m4/getopt.m4288
-rw-r--r--gl/m4/gettext.m42
-rw-r--r--gl/m4/glibc2.m410
-rw-r--r--gl/m4/glibc21.m410
-rw-r--r--gl/m4/gnulib-cache.m42
-rw-r--r--gl/m4/gnulib-common.m4105
-rw-r--r--gl/m4/gnulib-comp.m4305
-rw-r--r--gl/m4/gnulib-tool.m42
-rw-r--r--gl/m4/hostent.m42
-rw-r--r--gl/m4/iconv.m429
-rw-r--r--gl/m4/include_next.m498
-rw-r--r--gl/m4/inet_ntop.m421
-rw-r--r--gl/m4/inline.m42
-rw-r--r--gl/m4/intdiv0.m42
-rw-r--r--gl/m4/intl.m42
-rw-r--r--gl/m4/intldir.m42
-rw-r--r--gl/m4/intlmacosx.m42
-rw-r--r--gl/m4/intmax.m42
-rw-r--r--gl/m4/intmax_t.m43
-rw-r--r--gl/m4/inttypes-pri.m42
-rw-r--r--gl/m4/inttypes_h.m42
-rw-r--r--gl/m4/langinfo_h.m477
-rw-r--r--gl/m4/lcmessage.m43
-rw-r--r--gl/m4/lib-ld.m48
-rw-r--r--gl/m4/lib-link.m49
-rw-r--r--gl/m4/lib-prefix.m42
-rw-r--r--gl/m4/localcharset.m45
-rw-r--r--gl/m4/locale-fr.m42
-rw-r--r--gl/m4/locale-ja.m42
-rw-r--r--gl/m4/locale-zh.m42
-rw-r--r--gl/m4/locale_h.m492
-rw-r--r--gl/m4/lock.m42
-rw-r--r--gl/m4/longlong.m466
-rw-r--r--gl/m4/ls-mntd-fs.m486
-rw-r--r--gl/m4/malloc.m42
-rw-r--r--gl/m4/math_h.m453
-rw-r--r--gl/m4/mbrtowc.m465
-rw-r--r--gl/m4/mbsinit.m412
-rw-r--r--gl/m4/mbstate_t.m418
-rw-r--r--gl/m4/memchr.m485
-rw-r--r--gl/m4/mktime.m467
-rw-r--r--gl/m4/mmap-anon.m459
-rw-r--r--gl/m4/mode_t.m426
-rw-r--r--gl/m4/mountlist.m44
-rw-r--r--gl/m4/multiarch.m42
-rw-r--r--gl/m4/netdb_h.m47
-rw-r--r--gl/m4/netinet_in_h.m42
-rw-r--r--gl/m4/nl_langinfo.m425
-rw-r--r--gl/m4/nls.m43
-rw-r--r--gl/m4/onceonly.m43
-rw-r--r--gl/m4/open.m426
-rw-r--r--gl/m4/po.m42
-rw-r--r--gl/m4/printf-posix.m42
-rw-r--r--gl/m4/printf.m42
-rw-r--r--gl/m4/progtest.m42
-rw-r--r--gl/m4/regex.m4275
-rw-r--r--gl/m4/safe-read.m43
-rw-r--r--gl/m4/safe-write.m42
-rw-r--r--gl/m4/servent.m42
-rw-r--r--gl/m4/size_max.m417
-rw-r--r--gl/m4/snprintf.m42
-rw-r--r--gl/m4/sockets.m490
-rw-r--r--gl/m4/socklen.m440
-rw-r--r--gl/m4/sockpfaf.m420
-rw-r--r--gl/m4/ssize_t.m42
-rw-r--r--gl/m4/stat.m463
-rw-r--r--gl/m4/stdbool.m4140
-rw-r--r--gl/m4/stddef_h.m445
-rw-r--r--gl/m4/stdint.m414
-rw-r--r--gl/m4/stdint_h.m42
-rw-r--r--gl/m4/stdio_h.m4127
-rw-r--r--gl/m4/stdlib_h.m455
-rw-r--r--gl/m4/strdup.m425
-rw-r--r--gl/m4/strerror.m42
-rw-r--r--gl/m4/string_h.m475
-rw-r--r--gl/m4/strndup.m448
-rw-r--r--gl/m4/strnlen.m43
-rw-r--r--gl/m4/strstr.m479
-rw-r--r--gl/m4/sys_socket_h.m437
-rw-r--r--gl/m4/sys_stat_h.m482
-rw-r--r--gl/m4/threadlib.m454
-rw-r--r--gl/m4/time_h.m462
-rw-r--r--gl/m4/time_r.m449
-rw-r--r--gl/m4/timegm.m426
-rw-r--r--gl/m4/uintmax_t.m42
-rw-r--r--gl/m4/unistd-safer.m42
-rw-r--r--gl/m4/unistd_h.m481
-rw-r--r--gl/m4/vasnprintf.m42
-rw-r--r--gl/m4/vasprintf.m43
-rw-r--r--gl/m4/visibility.m42
-rw-r--r--gl/m4/vsnprintf.m42
-rw-r--r--gl/m4/warn-on-use.m445
-rw-r--r--gl/m4/wchar_h.m4 (renamed from gl/m4/wchar.m4)104
-rw-r--r--gl/m4/wchar_t.m42
-rw-r--r--gl/m4/wcrtomb.m475
-rw-r--r--gl/m4/wctype_h.m4 (renamed from gl/m4/wctype.m4)36
-rw-r--r--gl/m4/wint_t.m42
-rw-r--r--gl/m4/write.m42
-rw-r--r--gl/m4/xalloc.m43
-rw-r--r--gl/m4/xsize.m42
-rw-r--r--gl/m4/xstrndup.m42
129 files changed, 3212 insertions, 1156 deletions
diff --git a/gl/m4/00gnulib.m4 b/gl/m4/00gnulib.m4
index d4d04d1..301469b 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 Free Software Foundation, Inc. 2dnl Copyright (C) 2009-2010 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 4b978e1..f3ee343 100644
--- a/gl/m4/alloca.m4
+++ b/gl/m4/alloca.m4
@@ -1,5 +1,6 @@
1# alloca.m4 serial 9 1# alloca.m4 serial 9
2dnl Copyright (C) 2002-2004, 2006, 2007, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2004, 2006-2007, 2009-2010 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.
diff --git a/gl/m4/arpa_inet_h.m4 b/gl/m4/arpa_inet_h.m4
index a6e63df..15a30e2 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 5 1# arpa_inet_h.m4 serial 8
2dnl Copyright (C) 2006, 2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2006, 2008, 2009, 2010 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,27 +16,35 @@ AC_DEFUN([gl_HEADER_ARPA_INET],
16 if test $ac_cv_header_arpa_inet_h = yes; then 16 if test $ac_cv_header_arpa_inet_h = yes; then
17 HAVE_ARPA_INET_H=1 17 HAVE_ARPA_INET_H=1
18 else 18 else
19 ARPA_INET_H='arpa/inet.h'
20 HAVE_ARPA_INET_H=0 19 HAVE_ARPA_INET_H=0
21 fi 20 fi
22 AC_SUBST([HAVE_ARPA_INET_H]) 21 AC_SUBST([HAVE_ARPA_INET_H])
23 dnl Execute this unconditionally, because ARPA_INET_H may be set by other 22 dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK.
24 dnl modules, after this code is executed.
25 gl_CHECK_NEXT_HEADERS([arpa/inet.h]) 23 gl_CHECK_NEXT_HEADERS([arpa/inet.h])
24
25 dnl Check for declarations of anything we want to poison if the
26 dnl corresponding gnulib module is not in use.
27 gl_WARN_ON_USE_PREPARE([[
28/* On some systems, this header is not self-consistent. */
29#ifndef __GLIBC__
30# include <sys/socket.h>
31#endif
32#include <arpa/inet.h>
33 ]], [inet_ntop inet_pton])
26]) 34])
27 35
28dnl Unconditionally enables the replacement of <arpa/inet.h>. 36dnl Unconditionally enables the replacement of <arpa/inet.h>.
29AC_DEFUN([gl_REPLACE_ARPA_INET_H], 37AC_DEFUN([gl_REPLACE_ARPA_INET_H],
30[ 38[
31 AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) 39 dnl This is a no-op, because <arpa/inet.h> is always overridden.
32 ARPA_INET_H='arpa/inet.h' 40 :
33]) 41])
34 42
35AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR], 43AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
36[ 44[
37 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 45 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
38 AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) 46 AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
39 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 47 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
40]) 48])
41 49
42AC_DEFUN([gl_ARPA_INET_H_DEFAULTS], 50AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
@@ -46,5 +54,4 @@ AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
46 dnl Assume proper GNU behavior unless another module says otherwise. 54 dnl Assume proper GNU behavior unless another module says otherwise.
47 HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP]) 55 HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP])
48 HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON]) 56 HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON])
49 ARPA_INET_H=''; AC_SUBST([ARPA_INET_H])
50]) 57])
diff --git a/gl/m4/base64.m4 b/gl/m4/base64.m4
index 24801ef..d1e1352 100644
--- a/gl/m4/base64.m4
+++ b/gl/m4/base64.m4
@@ -1,5 +1,5 @@
1# base64.m4 serial 3 1# base64.m4 serial 3
2dnl Copyright (C) 2004, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2004, 2006, 2009, 2010 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/btowc.m4 b/gl/m4/btowc.m4
index b46f74f..c4ee4e4 100644
--- a/gl/m4/btowc.m4
+++ b/gl/m4/btowc.m4
@@ -1,5 +1,5 @@
1# btowc.m4 serial 4 1# btowc.m4 serial 6
2dnl Copyright (C) 2008-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2008-2010 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,49 @@ AC_DEFUN([gl_FUNC_BTOWC],
8[ 8[
9 AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) 9 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
10 10
11 dnl Check whether <wchar.h> is usable at all, first. Otherwise the test
12 dnl program below may lead to an endless loop. See
13 dnl <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>.
14 AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
15
11 AC_CHECK_FUNCS_ONCE([btowc]) 16 AC_CHECK_FUNCS_ONCE([btowc])
12 if test $ac_cv_func_btowc = no; then 17 if test $ac_cv_func_btowc = no; then
13 HAVE_BTOWC=0 18 HAVE_BTOWC=0
14 else 19 else
15 20
16 dnl IRIX 6.5 btowc(EOF) is 0xFF, not WEOF.
17 AC_REQUIRE([AC_PROG_CC]) 21 AC_REQUIRE([AC_PROG_CC])
18 AC_REQUIRE([gt_LOCALE_FR]) 22 AC_REQUIRE([gt_LOCALE_FR])
19 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 23 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
24
25 dnl Cygwin 1.7.2 btowc('\0') is WEOF, not 0.
26 AC_CACHE_CHECK([whether btowc(0) is correct],
27 [gl_cv_func_btowc_nul],
28 [
29 AC_TRY_RUN([
30#include <stdio.h>
31#include <string.h>
32#include <wchar.h>
33int main ()
34{
35 if (btowc ('\0') != 0)
36 return 1;
37 return 0;
38}],
39 [gl_cv_func_btowc_nul=yes],
40 [gl_cv_func_btowc_nul=no],
41 [
42changequote(,)dnl
43 case "$host_os" in
44 # Guess no on Cygwin.
45 cygwin*) gl_cv_func_btowc_nul="guessing no" ;;
46 # Guess yes otherwise.
47 *) gl_cv_func_btowc_nul="guessing yes" ;;
48 esac
49changequote([,])dnl
50 ])
51 ])
52
53 dnl IRIX 6.5 btowc(EOF) is 0xFF, not WEOF.
20 AC_CACHE_CHECK([whether btowc(EOF) is correct], 54 AC_CACHE_CHECK([whether btowc(EOF) is correct],
21 [gl_cv_func_btowc_eof], 55 [gl_cv_func_btowc_eof],
22 [ 56 [
@@ -50,6 +84,11 @@ int main ()
50 [:]) 84 [:])
51 fi 85 fi
52 ]) 86 ])
87
88 case "$gl_cv_func_btowc_nul" in
89 *yes) ;;
90 *) REPLACE_BTOWC=1 ;;
91 esac
53 case "$gl_cv_func_btowc_eof" in 92 case "$gl_cv_func_btowc_eof" in
54 *yes) ;; 93 *yes) ;;
55 *) REPLACE_BTOWC=1 ;; 94 *) REPLACE_BTOWC=1 ;;
diff --git a/gl/m4/c-strtod.m4 b/gl/m4/c-strtod.m4
index ba95435..41cf18e 100644
--- a/gl/m4/c-strtod.m4
+++ b/gl/m4/c-strtod.m4
@@ -1,6 +1,6 @@
1# c-strtod.m4 serial 11 1# c-strtod.m4 serial 11
2 2
3# Copyright (C) 2004, 2005, 2006, 2009 Free Software Foundation, Inc. 3# Copyright (C) 2004-2006, 2009-2010 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.
@@ -14,17 +14,17 @@ AC_DEFUN([gl_C99_STRTOLD],
14 [AC_LINK_IFELSE( 14 [AC_LINK_IFELSE(
15 [AC_LANG_PROGRAM( 15 [AC_LANG_PROGRAM(
16 [[/* On HP-UX before 11.23, strtold returns a struct instead of 16 [[/* On HP-UX before 11.23, strtold returns a struct instead of
17 long double. Reject implementations like that, by requiring 17 long double. Reject implementations like that, by requiring
18 compatibility with the C99 prototype. */ 18 compatibility with the C99 prototype. */
19 #include <stdlib.h> 19 #include <stdlib.h>
20 static long double (*p) (char const *, char **) = strtold; 20 static long double (*p) (char const *, char **) = strtold;
21 static long double 21 static long double
22 test (char const *nptr, char **endptr) 22 test (char const *nptr, char **endptr)
23 { 23 {
24 long double r; 24 long double r;
25 r = strtold (nptr, endptr); 25 r = strtold (nptr, endptr);
26 return r; 26 return r;
27 }]], 27 }]],
28 [[return test ("1.0", NULL) != 1 || p ("1.0", NULL) != 1;]])], 28 [[return test ("1.0", NULL) != 1 || p ("1.0", NULL) != 1;]])],
29 [gl_cv_func_c99_strtold=yes], 29 [gl_cv_func_c99_strtold=yes],
30 [gl_cv_func_c99_strtold=no])]) 30 [gl_cv_func_c99_strtold=no])])
diff --git a/gl/m4/cloexec.m4 b/gl/m4/cloexec.m4
index 4c4e26a..c75595c 100644
--- a/gl/m4/cloexec.m4
+++ b/gl/m4/cloexec.m4
@@ -1,5 +1,5 @@
1#serial 6 1#serial 6
2dnl Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2004-2006, 2009-2010 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/codeset.m4 b/gl/m4/codeset.m4
index 413217b..a53c042 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 4 (gettext-0.18)
2dnl Copyright (C) 2000-2002, 2006, 2008, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2006, 2008-2010 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/dirname.m4 b/gl/m4/dirname.m4
index e35da96..576b5be 100644
--- a/gl/m4/dirname.m4
+++ b/gl/m4/dirname.m4
@@ -1,18 +1,26 @@
1#serial 7 -*- autoconf -*- 1#serial 8 -*- autoconf -*-
2dnl Copyright (C) 2002-2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2006, 2009-2010 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_DIRNAME], 7AC_DEFUN([gl_DIRNAME],
8[ 8[
9 AC_REQUIRE([gl_DIRNAME_LGPL])
9 AC_LIBOBJ([basename]) 10 AC_LIBOBJ([basename])
10 AC_LIBOBJ([dirname]) 11 AC_LIBOBJ([dirname])
12])
13
14AC_DEFUN([gl_DIRNAME_LGPL],
15[
16 AC_LIBOBJ([basename-lgpl])
17 AC_LIBOBJ([dirname-lgpl])
11 AC_LIBOBJ([stripslash]) 18 AC_LIBOBJ([stripslash])
12 19
13 dnl Prerequisites of lib/dirname.h. 20 dnl Prerequisites of lib/dirname.h.
14 AC_REQUIRE([gl_AC_DOS]) 21 AC_REQUIRE([gl_AC_DOS])
15 AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) 22 AC_REQUIRE([gl_DOUBLE_SLASH_ROOT])
16 23
17 dnl No prerequisites of lib/basename.c, lib/dirname.c, lib/stripslash.c. 24 dnl No prerequisites of lib/basename-lgpl.c, lib/dirname-lgpl.c,
25 dnl lib/stripslash.c.
18]) 26])
diff --git a/gl/m4/dos.m4 b/gl/m4/dos.m4
index dd59571..5660542 100644
--- a/gl/m4/dos.m4
+++ b/gl/m4/dos.m4
@@ -1,9 +1,9 @@
1#serial 10 -*- autoconf -*- 1#serial 11 -*- autoconf -*-
2 2
3# Define some macros required for proper operation of code in lib/*.c 3# Define some macros required for proper operation of code in lib/*.c
4# on MSDOS/Windows systems. 4# on MSDOS/Windows systems.
5 5
6# Copyright (C) 2000, 2001, 2004, 2005, 2006 Free Software Foundation, Inc. 6# Copyright (C) 2000-2001, 2004-2006, 2009-2010 Free Software Foundation, Inc.
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,
9# with or without modifications, as long as this notice is preserved. 9# with or without modifications, as long as this notice is preserved.
@@ -14,31 +14,31 @@ AC_DEFUN([gl_AC_DOS],
14 [ 14 [
15 AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos], 15 AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
16 [ 16 [
17 AC_TRY_COMPILE([], 17 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
18 [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__ 18#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__
19neither MSDOS nor Windows 19neither MSDOS nor Windows
20#endif], 20#endif]])],
21 [ac_cv_win_or_dos=yes], 21 [ac_cv_win_or_dos=yes],
22 [ac_cv_win_or_dos=no]) 22 [ac_cv_win_or_dos=no])
23 ]) 23 ])
24 24
25 if test x"$ac_cv_win_or_dos" = xyes; then 25 if test x"$ac_cv_win_or_dos" = xyes; then
26 ac_fs_accepts_drive_letter_prefix=1 26 ac_fs_accepts_drive_letter_prefix=1
27 ac_fs_backslash_is_file_name_separator=1 27 ac_fs_backslash_is_file_name_separator=1
28 AC_CACHE_CHECK([whether drive letter can start relative path], 28 AC_CACHE_CHECK([whether drive letter can start relative path],
29 [ac_cv_drive_letter_can_be_relative], 29 [ac_cv_drive_letter_can_be_relative],
30 [ 30 [
31 AC_TRY_COMPILE([], 31 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
32 [#if defined __CYGWIN__ 32#if defined __CYGWIN__
33drive letters are always absolute 33drive letters are always absolute
34#endif], 34#endif]])],
35 [ac_cv_drive_letter_can_be_relative=yes], 35 [ac_cv_drive_letter_can_be_relative=yes],
36 [ac_cv_drive_letter_can_be_relative=no]) 36 [ac_cv_drive_letter_can_be_relative=no])
37 ]) 37 ])
38 if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then 38 if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then
39 ac_fs_drive_letter_can_be_relative=1 39 ac_fs_drive_letter_can_be_relative=1
40 else 40 else
41 ac_fs_drive_letter_can_be_relative=0 41 ac_fs_drive_letter_can_be_relative=0
42 fi 42 fi
43 else 43 else
44 ac_fs_accepts_drive_letter_prefix=0 44 ac_fs_accepts_drive_letter_prefix=0
diff --git a/gl/m4/double-slash-root.m4 b/gl/m4/double-slash-root.m4
index 8c6841b..66a79c0 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, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2006, 2008-2010 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,27 +9,27 @@ AC_DEFUN([gl_DOUBLE_SLASH_ROOT],
9 AC_REQUIRE([AC_CANONICAL_HOST]) 9 AC_REQUIRE([AC_CANONICAL_HOST])
10 AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root], 10 AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root],
11 [ if test x"$cross_compiling" = xyes ; then 11 [ if test x"$cross_compiling" = xyes ; then
12 # When cross-compiling, there is no way to tell whether // is special 12 # When cross-compiling, there is no way to tell whether // is special
13 # short of a list of hosts. However, the only known hosts to date 13 # short of a list of hosts. However, the only known hosts to date
14 # that have a distinct // are Apollo DomainOS (too old to port to), 14 # that have a distinct // are Apollo DomainOS (too old to port to),
15 # Cygwin, and z/OS. If anyone knows of another system for which // has 15 # Cygwin, and z/OS. If anyone knows of another system for which // has
16 # special semantics and is distinct from /, please report it to 16 # special semantics and is distinct from /, please report it to
17 # <bug-gnulib@gnu.org>. 17 # <bug-gnulib@gnu.org>.
18 case $host in 18 case $host in
19 *-cygwin | i370-ibm-openedition) 19 *-cygwin | i370-ibm-openedition)
20 gl_cv_double_slash_root=yes ;; 20 gl_cv_double_slash_root=yes ;;
21 *) 21 *)
22 # Be optimistic and assume that / and // are the same when we 22 # Be optimistic and assume that / and // are the same when we
23 # don't know. 23 # don't know.
24 gl_cv_double_slash_root='unknown, assuming no' ;; 24 gl_cv_double_slash_root='unknown, assuming no' ;;
25 esac 25 esac
26 else 26 else
27 set x `ls -di / // 2>/dev/null` 27 set x `ls -di / // 2>/dev/null`
28 if test "$[2]" = "$[4]" && wc //dev/null >/dev/null 2>&1; then 28 if test "$[2]" = "$[4]" && wc //dev/null >/dev/null 2>&1; then
29 gl_cv_double_slash_root=no 29 gl_cv_double_slash_root=no
30 else 30 else
31 gl_cv_double_slash_root=yes 31 gl_cv_double_slash_root=yes
32 fi 32 fi
33 fi]) 33 fi])
34 if test "$gl_cv_double_slash_root" = yes; then 34 if test "$gl_cv_double_slash_root" = yes; then
35 AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], [1], 35 AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], [1],
diff --git a/gl/m4/dup2.m4 b/gl/m4/dup2.m4
new file mode 100644
index 0000000..998d66f
--- /dev/null
+++ b/gl/m4/dup2.m4
@@ -0,0 +1,58 @@
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/errno_h.m4 b/gl/m4/errno_h.m4
index 16188d9..d02a039 100644
--- a/gl/m4/errno_h.m4
+++ b/gl/m4/errno_h.m4
@@ -1,5 +1,5 @@
1# errno_h.m4 serial 5 1# errno_h.m4 serial 6
2dnl Copyright (C) 2004, 2006, 2008, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2004, 2006, 2008, 2009, 2010 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,6 +34,9 @@ booboo
34#if !defined ENOTSUP 34#if !defined ENOTSUP
35booboo 35booboo
36#endif 36#endif
37#if !defined ESTALE
38booboo
39#endif
37#if !defined ECANCELED 40#if !defined ECANCELED
38booboo 41booboo
39#endif 42#endif
diff --git a/gl/m4/error.m4 b/gl/m4/error.m4
index 7c7746e..9f1307a 100644
--- a/gl/m4/error.m4
+++ b/gl/m4/error.m4
@@ -1,7 +1,6 @@
1#serial 11 1#serial 12
2 2
3# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004 Free Software 3# Copyright (C) 1996-1998, 2001-2004, 2009-2010 Free Software Foundation, Inc.
4# 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,
@@ -18,5 +17,6 @@ AC_DEFUN([gl_ERROR],
18AC_DEFUN([gl_PREREQ_ERROR], 17AC_DEFUN([gl_PREREQ_ERROR],
19[ 18[
20 AC_REQUIRE([AC_FUNC_STRERROR_R]) 19 AC_REQUIRE([AC_FUNC_STRERROR_R])
20 AC_REQUIRE([AC_C_INLINE])
21 : 21 :
22]) 22])
diff --git a/gl/m4/exitfail.m4 b/gl/m4/exitfail.m4
deleted file mode 100644
index b7a691e..0000000
--- a/gl/m4/exitfail.m4
+++ /dev/null
@@ -1,13 +0,0 @@
1# exitfail.m4 serial 6
2dnl Copyright (C) 2002, 2003, 2005, 2006 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_EXITFAIL],
8[
9 AC_LIBOBJ([exitfail])
10
11 dnl No prerequisites of lib/exitfail.c.
12 :
13])
diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4
index ba6d5e1..7d9458a 100644
--- a/gl/m4/extensions.m4
+++ b/gl/m4/extensions.m4
@@ -1,7 +1,7 @@
1# serial 8 -*- Autoconf -*- 1# serial 9 -*- 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-2009 Free Software Foundation, Inc. 4# Copyright (C) 2003, 2006-2010 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.
@@ -12,6 +12,20 @@
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
15# If autoconf reports a warning
16# warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
17# or warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
18# the fix is
19# 1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked
20# but always AC_REQUIREd,
21# 2) to ensure that for each occurrence of
22# AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
23# or
24# AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
25# the corresponding gnulib module description has 'extensions' among
26# its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS
27# invocation occurs in gl_EARLY, not in gl_INIT.
28
15# AC_USE_SYSTEM_EXTENSIONS 29# AC_USE_SYSTEM_EXTENSIONS
16# ------------------------ 30# ------------------------
17# Enable extensions on systems that normally disable them, 31# Enable extensions on systems that normally disable them,
@@ -74,8 +88,8 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
74 [ac_cv_safe_to_define___extensions__], 88 [ac_cv_safe_to_define___extensions__],
75 [AC_COMPILE_IFELSE( 89 [AC_COMPILE_IFELSE(
76 [AC_LANG_PROGRAM([[ 90 [AC_LANG_PROGRAM([[
77# define __EXTENSIONS__ 1 91# define __EXTENSIONS__ 1
78 ]AC_INCLUDES_DEFAULT])], 92 ]AC_INCLUDES_DEFAULT])],
79 [ac_cv_safe_to_define___extensions__=yes], 93 [ac_cv_safe_to_define___extensions__=yes],
80 [ac_cv_safe_to_define___extensions__=no])]) 94 [ac_cv_safe_to_define___extensions__=no])])
81 test $ac_cv_safe_to_define___extensions__ = yes && 95 test $ac_cv_safe_to_define___extensions__ = yes &&
diff --git a/gl/m4/fcntl-o.m4 b/gl/m4/fcntl-o.m4
new file mode 100644
index 0000000..d416a61
--- /dev/null
+++ b/gl/m4/fcntl-o.m4
@@ -0,0 +1,81 @@
1# fcntl-o.m4 serial 1
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 Written by Paul Eggert.
8
9# Test whether the flags O_NOATIME and O_NOFOLLOW actually work.
10# Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise.
11# Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise.
12AC_DEFUN([gl_FCNTL_O_FLAGS],
13[
14 dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW.
15 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
16 AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h],
17 [AC_RUN_IFELSE(
18 [AC_LANG_PROGRAM(
19 [[#include <sys/types.h>
20 #include <sys/stat.h>
21 #include <unistd.h>
22 #include <fcntl.h>
23 #ifndef O_NOATIME
24 #define O_NOATIME 0
25 #endif
26 #ifndef O_NOFOLLOW
27 #define O_NOFOLLOW 0
28 #endif
29 static int const constants[] =
30 {
31 O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND,
32 O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY
33 };
34 ]],
35 [[
36 int status = !constants;
37 {
38 static char const sym[] = "conftest.sym";
39 if (symlink (".", sym) != 0
40 || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0)
41 status |= 32;
42 unlink (sym);
43 }
44 {
45 static char const file[] = "confdefs.h";
46 int fd = open (file, O_RDONLY | O_NOATIME);
47 char c;
48 struct stat st0, st1;
49 if (fd < 0
50 || fstat (fd, &st0) != 0
51 || sleep (1) != 0
52 || read (fd, &c, 1) != 1
53 || close (fd) != 0
54 || stat (file, &st1) != 0
55 || st0.st_atime != st1.st_atime)
56 status |= 64;
57 }
58 return status;]])],
59 [gl_cv_header_working_fcntl_h=yes],
60 [case $? in #(
61 32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #(
62 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)';; #(
64 *) gl_cv_header_working_fcntl_h='no';;
65 esac],
66 [gl_cv_header_working_fcntl_h=cross-compiling])])
67
68 case $gl_cv_header_working_fcntl_h in #(
69 *O_NOATIME* | no | cross-compiling) ac_val=0;; #(
70 *) ac_val=1;;
71 esac
72 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val],
73 [Define to 1 if O_NOATIME works.])
74
75 case $gl_cv_header_working_fcntl_h in #(
76 *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #(
77 *) ac_val=1;;
78 esac
79 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val],
80 [Define to 1 if O_NOFOLLOW works.])
81])
diff --git a/gl/m4/fcntl-safer.m4 b/gl/m4/fcntl-safer.m4
index 3475b0a..1a739b0 100644
--- a/gl/m4/fcntl-safer.m4
+++ b/gl/m4/fcntl-safer.m4
@@ -1,5 +1,5 @@
1#serial 5 1#serial 7
2dnl Copyright (C) 2005-2007 Free Software Foundation, Inc. 2dnl Copyright (C) 2005-2007, 2009-2010 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,4 +8,12 @@ AC_DEFUN([gl_FCNTL_SAFER],
8[ 8[
9 AC_LIBOBJ([open-safer]) 9 AC_LIBOBJ([open-safer])
10 AC_LIBOBJ([creat-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])
11]) 19])
diff --git a/gl/m4/fcntl.m4 b/gl/m4/fcntl.m4
new file mode 100644
index 0000000..fcb5f44
--- /dev/null
+++ b/gl/m4/fcntl.m4
@@ -0,0 +1,83 @@
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
index 1ae0b15..e41915c 100644
--- a/gl/m4/fcntl_h.m4
+++ b/gl/m4/fcntl_h.m4
@@ -1,5 +1,6 @@
1# serial 12
1# Configure fcntl.h. 2# Configure fcntl.h.
2dnl Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc. 3dnl Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, 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.
@@ -9,88 +10,34 @@ dnl Written by Paul Eggert.
9AC_DEFUN([gl_FCNTL_H], 10AC_DEFUN([gl_FCNTL_H],
10[ 11[
11 AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) 12 AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
12 dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW. 13 AC_REQUIRE([gl_FCNTL_O_FLAGS])
13 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
14 AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h],
15 [AC_RUN_IFELSE(
16 [AC_LANG_PROGRAM(
17 [[#include <sys/types.h>
18 #include <sys/stat.h>
19 #include <unistd.h>
20 #include <fcntl.h>
21 #ifndef O_NOATIME
22 #define O_NOATIME 0
23 #endif
24 #ifndef O_NOFOLLOW
25 #define O_NOFOLLOW 0
26 #endif
27 static int const constants[] =
28 {
29 O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND,
30 O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY
31 };
32 ]],
33 [[
34 int status = !constants;
35 {
36 static char const sym[] = "conftest.sym";
37 if (symlink (".", sym) != 0
38 || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0)
39 status |= 32;
40 }
41 {
42 static char const file[] = "confdefs.h";
43 int fd = open (file, O_RDONLY | O_NOATIME);
44 char c;
45 struct stat st0, st1;
46 if (fd < 0
47 || fstat (fd, &st0) != 0
48 || sleep (1) != 0
49 || read (fd, &c, 1) != 1
50 || close (fd) != 0
51 || stat (file, &st1) != 0
52 || st0.st_atime != st1.st_atime)
53 status |= 64;
54 }
55 return status;]])],
56 [gl_cv_header_working_fcntl_h=yes],
57 [case $? in #(
58 32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #(
59 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #(
60 96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #(
61 *) gl_cv_header_working_fcntl_h='no';;
62 esac],
63 [gl_cv_header_working_fcntl_h=cross-compiling])])
64
65 case $gl_cv_header_working_fcntl_h in #(
66 *O_NOATIME* | no | cross-compiling) ac_val=0;; #(
67 *) ac_val=1;;
68 esac
69 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val],
70 [Define to 1 if O_NOATIME works.])
71
72 case $gl_cv_header_working_fcntl_h in #(
73 *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #(
74 *) ac_val=1;;
75 esac
76 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val],
77 [Define to 1 if O_NOFOLLOW works.])
78
79 gl_CHECK_NEXT_HEADERS([fcntl.h]) 14 gl_CHECK_NEXT_HEADERS([fcntl.h])
80 FCNTL_H='fcntl.h' 15
81 AC_SUBST([FCNTL_H]) 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])
82]) 21])
83 22
84AC_DEFUN([gl_FCNTL_MODULE_INDICATOR], 23AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
85[ 24[
86 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 25 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
87 AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) 26 AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
88 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 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])
89]) 30])
90 31
91AC_DEFUN([gl_FCNTL_H_DEFAULTS], 32AC_DEFUN([gl_FCNTL_H_DEFAULTS],
92[ 33[
93 GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN]) 34 GNULIB_FCNTL=0; AC_SUBST([GNULIB_FCNTL])
35 GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN])
36 GNULIB_OPENAT=0; AC_SUBST([GNULIB_OPENAT])
94 dnl Assume proper GNU behavior unless another module says otherwise. 37 dnl Assume proper GNU behavior unless another module says otherwise.
95 REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) 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])
96]) 43])
diff --git a/gl/m4/float_h.m4 b/gl/m4/float_h.m4
index d36e3a4..a74a0d9 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 3
2dnl Copyright (C) 2007 Free Software Foundation, Inc. 2dnl Copyright (C) 2007, 2009, 2010 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/floorf.m4 b/gl/m4/floorf.m4
index 915e566..fb17a5e 100644
--- a/gl/m4/floorf.m4
+++ b/gl/m4/floorf.m4
@@ -1,5 +1,5 @@
1# floorf.m4 serial 4 1# floorf.m4 serial 6
2dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2007, 2009-2010 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,13 +20,12 @@ AC_DEFUN([gl_FUNC_FLOORF],
20 REPLACE_FLOORF=1 20 REPLACE_FLOORF=1
21 fi 21 fi
22 else 22 else
23 REPLACE_FLOORF=1 23 HAVE_DECL_FLOORF=0
24 fi 24 fi
25 if test $REPLACE_FLOORF = 1; then 25 if test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1; then
26 AC_LIBOBJ([floorf]) 26 AC_LIBOBJ([floorf])
27 FLOORF_LIBM= 27 FLOORF_LIBM=
28 fi 28 fi
29 AC_SUBST([REPLACE_FLOORF])
30 AC_SUBST([FLOORF_LIBM]) 29 AC_SUBST([FLOORF_LIBM])
31]) 30])
32 31
diff --git a/gl/m4/fstypename.m4 b/gl/m4/fstypename.m4
index aa676f3..9e81efe 100644
--- a/gl/m4/fstypename.m4
+++ b/gl/m4/fstypename.m4
@@ -6,7 +6,8 @@ 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 Free Software Foundation, Inc. 9# Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2010 Free Software
10# Foundation, Inc.
10# This file is free software; the Free Software Foundation 11# This file is free software; the Free Software Foundation
11# gives unlimited permission to copy and/or distribute it, 12# gives unlimited permission to copy and/or distribute it,
12# with or without modifications, as long as this notice is preserved. 13# with or without modifications, as long as this notice is preserved.
diff --git a/gl/m4/fsusage.m4 b/gl/m4/fsusage.m4
index 8b8cbf7..216b9dd 100644
--- a/gl/m4/fsusage.m4
+++ b/gl/m4/fsusage.m4
@@ -1,7 +1,7 @@
1# serial 24 1# serial 25
2# Obtaining file system usage information. 2# Obtaining file system usage information.
3 3
4# Copyright (C) 1997-1998, 2000-2001, 2003-2009 Free Software Foundation, Inc. 4# Copyright (C) 1997-1998, 2000-2001, 2003-2010 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,
@@ -46,7 +46,7 @@ ac_fsusage_space=no
46if test $ac_fsusage_space = no; then 46if test $ac_fsusage_space = no; then
47 # SVR4 47 # SVR4
48 AC_CACHE_CHECK([for statvfs function (SVR4)], [fu_cv_sys_stat_statvfs], 48 AC_CACHE_CHECK([for statvfs function (SVR4)], [fu_cv_sys_stat_statvfs],
49 [AC_TRY_LINK([#include <sys/types.h> 49 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
50#if defined __GLIBC__ && defined __linux__ 50#if defined __GLIBC__ && defined __linux__
51Do not use statvfs on systems with GNU libc on Linux, because that function 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 52stats all preceding entries in /proc/mounts, and that makes df hang if even
@@ -59,14 +59,14 @@ a system call.
59"Do not use Tru64's statvfs implementation" 59"Do not use Tru64's statvfs implementation"
60#endif 60#endif
61 61
62#include <sys/statvfs.h>], 62#include <sys/statvfs.h>]],
63 [struct statvfs fsd; statvfs (0, &fsd);], 63 [[struct statvfs fsd; statvfs (0, &fsd);]])],
64 fu_cv_sys_stat_statvfs=yes, 64 [fu_cv_sys_stat_statvfs=yes],
65 fu_cv_sys_stat_statvfs=no)]) 65 [fu_cv_sys_stat_statvfs=no])])
66 if test $fu_cv_sys_stat_statvfs = yes; then 66 if test $fu_cv_sys_stat_statvfs = yes; then
67 ac_fsusage_space=yes 67 ac_fsusage_space=yes
68 AC_DEFINE([STAT_STATVFS], [1], 68 AC_DEFINE([STAT_STATVFS], [1],
69 [ Define if there is a function named statvfs. (SVR4)]) 69 [ Define if there is a function named statvfs. (SVR4)])
70 fi 70 fi
71fi 71fi
72 72
@@ -74,7 +74,7 @@ if test $ac_fsusage_space = no; then
74 # DEC Alpha running OSF/1 74 # DEC Alpha running OSF/1
75 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)]) 75 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
76 AC_CACHE_VAL([fu_cv_sys_stat_statfs3_osf1], 76 AC_CACHE_VAL([fu_cv_sys_stat_statfs3_osf1],
77 [AC_TRY_RUN([ 77 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
78#include <sys/param.h> 78#include <sys/param.h>
79#include <sys/types.h> 79#include <sys/types.h>
80#include <sys/mount.h> 80#include <sys/mount.h>
@@ -84,15 +84,15 @@ if test $ac_fsusage_space = no; then
84 struct statfs fsd; 84 struct statfs fsd;
85 fsd.f_fsize = 0; 85 fsd.f_fsize = 0;
86 return statfs (".", &fsd, sizeof (struct statfs)) != 0; 86 return statfs (".", &fsd, sizeof (struct statfs)) != 0;
87 }], 87 }]])],
88 fu_cv_sys_stat_statfs3_osf1=yes, 88 [fu_cv_sys_stat_statfs3_osf1=yes],
89 fu_cv_sys_stat_statfs3_osf1=no, 89 [fu_cv_sys_stat_statfs3_osf1=no],
90 fu_cv_sys_stat_statfs3_osf1=no)]) 90 [fu_cv_sys_stat_statfs3_osf1=no])])
91 AC_MSG_RESULT([$fu_cv_sys_stat_statfs3_osf1]) 91 AC_MSG_RESULT([$fu_cv_sys_stat_statfs3_osf1])
92 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then 92 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
93 ac_fsusage_space=yes 93 ac_fsusage_space=yes
94 AC_DEFINE([STAT_STATFS3_OSF1], [1], 94 AC_DEFINE([STAT_STATFS3_OSF1], [1],
95 [ Define if statfs takes 3 args. (DEC Alpha running OSF/1)]) 95 [ Define if statfs takes 3 args. (DEC Alpha running OSF/1)])
96 fi 96 fi
97fi 97fi
98 98
@@ -101,7 +101,7 @@ if test $ac_fsusage_space = no; then
101 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl 101 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
102member (AIX, 4.3BSD)]) 102member (AIX, 4.3BSD)])
103 AC_CACHE_VAL([fu_cv_sys_stat_statfs2_bsize], 103 AC_CACHE_VAL([fu_cv_sys_stat_statfs2_bsize],
104 [AC_TRY_RUN([ 104 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
105#ifdef HAVE_SYS_PARAM_H 105#ifdef HAVE_SYS_PARAM_H
106#include <sys/param.h> 106#include <sys/param.h>
107#endif 107#endif
@@ -117,10 +117,10 @@ member (AIX, 4.3BSD)])
117 struct statfs fsd; 117 struct statfs fsd;
118 fsd.f_bsize = 0; 118 fsd.f_bsize = 0;
119 return statfs (".", &fsd) != 0; 119 return statfs (".", &fsd) != 0;
120 }], 120 }]])],
121 fu_cv_sys_stat_statfs2_bsize=yes, 121 [fu_cv_sys_stat_statfs2_bsize=yes],
122 fu_cv_sys_stat_statfs2_bsize=no, 122 [fu_cv_sys_stat_statfs2_bsize=no],
123 fu_cv_sys_stat_statfs2_bsize=no)]) 123 [fu_cv_sys_stat_statfs2_bsize=no])])
124 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize]) 124 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize])
125 if test $fu_cv_sys_stat_statfs2_bsize = yes; then 125 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
126 ac_fsusage_space=yes 126 ac_fsusage_space=yes
@@ -134,22 +134,23 @@ if test $ac_fsusage_space = no; then
134# SVR3 134# SVR3
135 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)]) 135 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
136 AC_CACHE_VAL([fu_cv_sys_stat_statfs4], 136 AC_CACHE_VAL([fu_cv_sys_stat_statfs4],
137 [AC_TRY_RUN([#include <sys/types.h> 137 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
138#include <sys/types.h>
138#include <sys/statfs.h> 139#include <sys/statfs.h>
139 int 140 int
140 main () 141 main ()
141 { 142 {
142 struct statfs fsd; 143 struct statfs fsd;
143 return statfs (".", &fsd, sizeof fsd, 0) != 0; 144 return statfs (".", &fsd, sizeof fsd, 0) != 0;
144 }], 145 }]])],
145 fu_cv_sys_stat_statfs4=yes, 146 [fu_cv_sys_stat_statfs4=yes],
146 fu_cv_sys_stat_statfs4=no, 147 [fu_cv_sys_stat_statfs4=no],
147 fu_cv_sys_stat_statfs4=no)]) 148 [fu_cv_sys_stat_statfs4=no])])
148 AC_MSG_RESULT([$fu_cv_sys_stat_statfs4]) 149 AC_MSG_RESULT([$fu_cv_sys_stat_statfs4])
149 if test $fu_cv_sys_stat_statfs4 = yes; then 150 if test $fu_cv_sys_stat_statfs4 = yes; then
150 ac_fsusage_space=yes 151 ac_fsusage_space=yes
151 AC_DEFINE([STAT_STATFS4], [1], 152 AC_DEFINE([STAT_STATFS4], [1],
152 [ Define if statfs takes 4 args. (SVR3, Dynix, Irix, Dolphin)]) 153 [ Define if statfs takes 4 args. (SVR3, Dynix, Irix, Dolphin)])
153 fi 154 fi
154fi 155fi
155 156
@@ -158,7 +159,8 @@ if test $ac_fsusage_space = no; then
158 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl 159 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
159member (4.4BSD and NetBSD)]) 160member (4.4BSD and NetBSD)])
160 AC_CACHE_VAL([fu_cv_sys_stat_statfs2_fsize], 161 AC_CACHE_VAL([fu_cv_sys_stat_statfs2_fsize],
161 [AC_TRY_RUN([#include <sys/types.h> 162 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
163#include <sys/types.h>
162#ifdef HAVE_SYS_PARAM_H 164#ifdef HAVE_SYS_PARAM_H
163#include <sys/param.h> 165#include <sys/param.h>
164#endif 166#endif
@@ -171,10 +173,10 @@ member (4.4BSD and NetBSD)])
171 struct statfs fsd; 173 struct statfs fsd;
172 fsd.f_fsize = 0; 174 fsd.f_fsize = 0;
173 return statfs (".", &fsd) != 0; 175 return statfs (".", &fsd) != 0;
174 }], 176 }]])],
175 fu_cv_sys_stat_statfs2_fsize=yes, 177 [fu_cv_sys_stat_statfs2_fsize=yes],
176 fu_cv_sys_stat_statfs2_fsize=no, 178 [fu_cv_sys_stat_statfs2_fsize=no],
177 fu_cv_sys_stat_statfs2_fsize=no)]) 179 [fu_cv_sys_stat_statfs2_fsize=no])])
178 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize]) 180 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize])
179 if test $fu_cv_sys_stat_statfs2_fsize = yes; then 181 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
180 ac_fsusage_space=yes 182 ac_fsusage_space=yes
@@ -188,7 +190,8 @@ if test $ac_fsusage_space = no; then
188 # Ultrix 190 # Ultrix
189 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)]) 191 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
190 AC_CACHE_VAL([fu_cv_sys_stat_fs_data], 192 AC_CACHE_VAL([fu_cv_sys_stat_fs_data],
191 [AC_TRY_RUN([#include <sys/types.h> 193 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
194#include <sys/types.h>
192#ifdef HAVE_SYS_PARAM_H 195#ifdef HAVE_SYS_PARAM_H
193#include <sys/param.h> 196#include <sys/param.h>
194#endif 197#endif
@@ -205,10 +208,10 @@ if test $ac_fsusage_space = no; then
205 /* Ultrix's statfs returns 1 for success, 208 /* Ultrix's statfs returns 1 for success,
206 0 for not mounted, -1 for failure. */ 209 0 for not mounted, -1 for failure. */
207 return statfs (".", &fsd) != 1; 210 return statfs (".", &fsd) != 1;
208 }], 211 }]])],
209 fu_cv_sys_stat_fs_data=yes, 212 [fu_cv_sys_stat_fs_data=yes],
210 fu_cv_sys_stat_fs_data=no, 213 [fu_cv_sys_stat_fs_data=no],
211 fu_cv_sys_stat_fs_data=no)]) 214 [fu_cv_sys_stat_fs_data=no])])
212 AC_MSG_RESULT([$fu_cv_sys_stat_fs_data]) 215 AC_MSG_RESULT([$fu_cv_sys_stat_fs_data])
213 if test $fu_cv_sys_stat_fs_data = yes; then 216 if test $fu_cv_sys_stat_fs_data = yes; then
214 ac_fsusage_space=yes 217 ac_fsusage_space=yes
@@ -220,12 +223,12 @@ fi
220 223
221if test $ac_fsusage_space = no; then 224if test $ac_fsusage_space = no; then
222 # SVR2 225 # SVR2
223 AC_TRY_CPP([#include <sys/filsys.h> 226 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <sys/filsys.h>
224 ], 227 ]])],
225 AC_DEFINE([STAT_READ_FILSYS], [1], 228 [AC_DEFINE([STAT_READ_FILSYS], [1],
226 [Define if there is no specific function for reading file systems usage 229 [Define if there is no specific function for reading file systems usage
227 information and you have the <sys/filsys.h> header file. (SVR2)]) 230 information and you have the <sys/filsys.h> header file. (SVR2)])
228 ac_fsusage_space=yes) 231 ac_fsusage_space=yes])
229fi 232fi
230 233
231AS_IF([test $ac_fsusage_space = yes], [$1], [$2]) 234AS_IF([test $ac_fsusage_space = yes], [$1], [$2])
@@ -246,8 +249,8 @@ choke -- this is a workaround for a Sun-specific problem
246#endif 249#endif
247#include <sys/types.h> 250#include <sys/types.h>
248#include <sys/vfs.h>]], 251#include <sys/vfs.h>]],
249 [[struct statfs t; long c = *(t.f_spare); 252 [[struct statfs t; long c = *(t.f_spare);
250 if (c) return 0;]])], 253 if (c) return 0;]])],
251 [fu_cv_sys_truncating_statfs=yes], 254 [fu_cv_sys_truncating_statfs=yes],
252 [fu_cv_sys_truncating_statfs=no])]) 255 [fu_cv_sys_truncating_statfs=no])])
253 if test $fu_cv_sys_truncating_statfs = yes; then 256 if test $fu_cv_sys_truncating_statfs = yes; then
diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4
index 4088671..bc3066d 100644
--- a/gl/m4/getaddrinfo.m4
+++ b/gl/m4/getaddrinfo.m4
@@ -1,5 +1,5 @@
1# getaddrinfo.m4 serial 20 1# getaddrinfo.m4 serial 23
2dnl Copyright (C) 2004-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2004-2010 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,7 +25,7 @@ AC_DEFUN([gl_GETADDRINFO],
25 LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" 25 LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
26 26
27 AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [ 27 AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
28 AC_TRY_LINK([ 28 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
29#include <sys/types.h> 29#include <sys/types.h>
30#ifdef HAVE_SYS_SOCKET_H 30#ifdef HAVE_SYS_SOCKET_H
31#include <sys/socket.h> 31#include <sys/socket.h>
@@ -34,21 +34,21 @@ AC_DEFUN([gl_GETADDRINFO],
34#include <netdb.h> 34#include <netdb.h>
35#endif 35#endif
36#include <stddef.h> 36#include <stddef.h>
37], [getaddrinfo("", "", NULL, NULL);], 37]], [[getaddrinfo("", "", NULL, NULL);]])],
38 [gl_cv_func_getaddrinfo=yes], 38 [gl_cv_func_getaddrinfo=yes],
39 [gl_cv_func_getaddrinfo=no])]) 39 [gl_cv_func_getaddrinfo=no])])
40 if test $gl_cv_func_getaddrinfo = no; then 40 if test $gl_cv_func_getaddrinfo = no; then
41 AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32], 41 AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32],
42 gl_cv_w32_getaddrinfo, [ 42 gl_cv_w32_getaddrinfo, [
43 gl_cv_w32_getaddrinfo=no 43 gl_cv_w32_getaddrinfo=no
44 am_save_LIBS="$LIBS" 44 am_save_LIBS="$LIBS"
45 LIBS="$LIBS -lws2_32" 45 LIBS="$LIBS -lws2_32"
46 AC_TRY_LINK([ 46 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
47#ifdef HAVE_WS2TCPIP_H 47#ifdef HAVE_WS2TCPIP_H
48#include <ws2tcpip.h> 48#include <ws2tcpip.h>
49#endif 49#endif
50#include <stddef.h> 50#include <stddef.h>
51], [getaddrinfo(NULL, NULL, NULL, NULL);], gl_cv_w32_getaddrinfo=yes) 51]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], [gl_cv_w32_getaddrinfo=yes])
52 LIBS="$am_save_LIBS" 52 LIBS="$am_save_LIBS"
53 ]) 53 ])
54 if test "$gl_cv_w32_getaddrinfo" = "yes"; then 54 if test "$gl_cv_w32_getaddrinfo" = "yes"; then
@@ -64,7 +64,7 @@ AC_DEFUN([gl_GETADDRINFO],
64 # header included somehow. 64 # header included somehow.
65 AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)], 65 AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)],
66 gl_cv_func_gai_strerror, [ 66 gl_cv_func_gai_strerror, [
67 AC_TRY_LINK([ 67 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
68#include <sys/types.h> 68#include <sys/types.h>
69#ifdef HAVE_SYS_SOCKET_H 69#ifdef HAVE_SYS_SOCKET_H
70#include <sys/socket.h> 70#include <sys/socket.h>
@@ -76,7 +76,7 @@ AC_DEFUN([gl_GETADDRINFO],
76#include <ws2tcpip.h> 76#include <ws2tcpip.h>
77#endif 77#endif
78#include <stddef.h> 78#include <stddef.h>
79], [gai_strerror (NULL);], 79]], [[gai_strerror (NULL);]])],
80 [gl_cv_func_gai_strerror=yes], 80 [gl_cv_func_gai_strerror=yes],
81 [gl_cv_func_gai_strerror=no])]) 81 [gl_cv_func_gai_strerror=no])])
82 if test $gl_cv_func_gai_strerror = no; then 82 if test $gl_cv_func_gai_strerror = no; then
@@ -96,6 +96,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
96 AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H 96 AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
97 AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB 97 AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB
98 AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB 98 AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB
99 AC_REQUIRE([gl_FUNC_INET_NTOP]) dnl for INET_NTOP_LIB
99 AC_REQUIRE([AC_C_RESTRICT]) 100 AC_REQUIRE([AC_C_RESTRICT])
100 AC_REQUIRE([gl_SOCKET_FAMILIES]) 101 AC_REQUIRE([gl_SOCKET_FAMILIES])
101 AC_REQUIRE([gl_HEADER_SYS_SOCKET]) 102 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
@@ -163,4 +164,10 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
163 *" $SERVENT_LIB "*) ;; 164 *" $SERVENT_LIB "*) ;;
164 *) GETADDRINFO_LIB="$GETADDRINFO_LIB $SERVENT_LIB" ;; 165 *) GETADDRINFO_LIB="$GETADDRINFO_LIB $SERVENT_LIB" ;;
165 esac 166 esac
167
168 dnl Append $INET_NTOP_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates.
169 case " $GETADDRINFO_LIB " in
170 *" $INET_NTOP_LIB "*) ;;
171 *) GETADDRINFO_LIB="$GETADDRINFO_LIB $INET_NTOP_LIB" ;;
172 esac
166]) 173])
diff --git a/gl/m4/getdtablesize.m4 b/gl/m4/getdtablesize.m4
new file mode 100644
index 0000000..d238628
--- /dev/null
+++ b/gl/m4/getdtablesize.m4
@@ -0,0 +1,15 @@
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 6b6fca9..ef0b43e 100644
--- a/gl/m4/gethostname.m4
+++ b/gl/m4/gethostname.m4
@@ -1,21 +1,101 @@
1# gethostname.m4 serial 5 1# gethostname.m4 serial 9
2dnl Copyright (C) 2002, 2008, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2008, 2009, 2010 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# Ensure
8# - the gethostname() function,
9# - the HOST_NAME_MAX macro in <limits.h>.
7AC_DEFUN([gl_FUNC_GETHOSTNAME], 10AC_DEFUN([gl_FUNC_GETHOSTNAME],
8[ 11[
9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) 12 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
10 gl_PREREQ_SYS_H_WINSOCK2 13 gl_PREREQ_SYS_H_WINSOCK2
11 AC_REPLACE_FUNCS([gethostname]) 14
12 if test $ac_cv_func_gethostname = no; then 15 dnl Where is gethostname() defined?
16 dnl - On native Windows, it is in ws2_32.dll.
17 dnl - Otherwise is is in libc.
18 GETHOSTNAME_LIB=
19 AC_CHECK_FUNCS([gethostname], , [
20 AC_CACHE_CHECK([for gethostname in winsock2.h and -lws2_32],
21 [gl_cv_w32_gethostname],
22 [gl_cv_w32_gethostname=no
23 gl_save_LIBS="$LIBS"
24 LIBS="$LIBS -lws2_32"
25 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
26#ifdef HAVE_WINSOCK2_H
27#include <winsock2.h>
28#endif
29#include <stddef.h>
30]], [[gethostname(NULL, 0);]])], [gl_cv_w32_gethostname=yes])
31 LIBS="$gl_save_LIBS"
32 ])
33 if test "$gl_cv_w32_gethostname" = "yes"; then
34 GETHOSTNAME_LIB="-lws2_32"
35 fi
36 ])
37 AC_SUBST([GETHOSTNAME_LIB])
38
39 if test "$ac_cv_func_gethostname" = no; then
40 AC_LIBOBJ([gethostname])
13 HAVE_GETHOSTNAME=0 41 HAVE_GETHOSTNAME=0
14 gl_PREREQ_GETHOSTNAME 42 gl_PREREQ_GETHOSTNAME
15 fi 43 fi
44
45 dnl Also provide HOST_NAME_MAX when <limits.h> lacks it.
46 dnl - On most Unix systems, use MAXHOSTNAMELEN from <sys/param.h> instead.
47 dnl - On Solaris, Cygwin, BeOS, use MAXHOSTNAMELEN from <netdb.h> instead.
48 dnl - On mingw, use 256, because
49 dnl <http://msdn.microsoft.com/en-us/library/ms738527.aspx> says:
50 dnl "if a buffer of 256 bytes is passed in the name parameter and
51 dnl the namelen parameter is set to 256, the buffer size will always
52 dnl be adequate."
53 dnl With this, there is no need to use sysconf (_SC_HOST_NAME_MAX), which
54 dnl is not a compile-time constant.
55 dnl We cannot override <limits.h> using the usual technique, because
56 dnl gl_CHECK_NEXT_HEADERS does not work for <limits.h>. Therefore retrieve
57 dnl the value of HOST_NAME_MAX at configure time.
58 AC_CHECK_HEADERS_ONCE([sys/param.h])
59 AC_CHECK_HEADERS_ONCE([sys/socket.h])
60 AC_CHECK_HEADERS_ONCE([netdb.h])
61 AC_CACHE_CHECK([for HOST_NAME_MAX], [gl_cv_decl_HOST_NAME_MAX], [
62 gl_cv_decl_HOST_NAME_MAX=
63 AC_EGREP_CPP([lucky], [
64#include <limits.h>
65#ifdef HOST_NAME_MAX
66lucky
67#endif
68 ], [gl_cv_decl_HOST_NAME_MAX=yes])
69 if test -z "$gl_cv_decl_HOST_NAME_MAX"; then
70 dnl It's not defined in <limits.h>. Substitute it.
71 if test "$gl_cv_w32_gethostname" = yes; then
72 dnl mingw.
73 gl_cv_decl_HOST_NAME_MAX=256
74 else
75 _AC_COMPUTE_INT([MAXHOSTNAMELEN], [gl_cv_decl_HOST_NAME_MAX], [
76#include <sys/types.h>
77#if HAVE_SYS_PARAM_H
78# include <sys/param.h>
79#endif
80#if HAVE_SYS_SOCKET_H
81# include <sys/socket.h>
82#endif
83#if HAVE_NETDB_H
84# include <netdb.h>
85#endif
86])
87 fi
88 fi
89 ])
90 if test "$gl_cv_decl_HOST_NAME_MAX" != yes; then
91 AC_DEFINE_UNQUOTED([HOST_NAME_MAX], [$gl_cv_decl_HOST_NAME_MAX],
92 [Define HOST_NAME_MAX when <limits.h> does not define it.])
93 fi
16]) 94])
17 95
18# Prerequisites of lib/gethostname.c. 96# Prerequisites of lib/gethostname.c.
19AC_DEFUN([gl_PREREQ_GETHOSTNAME], [ 97AC_DEFUN([gl_PREREQ_GETHOSTNAME], [
20 AC_CHECK_FUNCS([uname]) 98 if test "$gl_cv_w32_gethostname" != "yes"; then
99 AC_CHECK_FUNCS([uname])
100 fi
21]) 101])
diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4
index 015bcac..0a731c4 100644
--- a/gl/m4/getloadavg.m4
+++ b/gl/m4/getloadavg.m4
@@ -1,7 +1,7 @@
1# Check for getloadavg. 1# Check for getloadavg.
2 2
3# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2002, 2003, 3# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2010 Free Software
4# 2006, 2008, 2009 Free Software 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,
@@ -60,17 +60,17 @@ if test $gl_have_func = no; then
60 gl_getloadavg_LIBS=$LIBS 60 gl_getloadavg_LIBS=$LIBS
61 LIBS="-L/usr/local/lib $LIBS" 61 LIBS="-L/usr/local/lib $LIBS"
62 AC_CHECK_LIB([getloadavg], [getloadavg], 62 AC_CHECK_LIB([getloadavg], [getloadavg],
63 [LIBS="-lgetloadavg $LIBS"], [LIBS=$gl_getloadavg_LIBS]) 63 [LIBS="-lgetloadavg $LIBS"], [LIBS=$gl_getloadavg_LIBS])
64fi 64fi
65 65
66# Make sure it is really in the library, if we think we found it, 66# Make sure it is really in the library, if we think we found it,
67# otherwise set up the replacement function. 67# otherwise set up the replacement function.
68AC_CHECK_FUNCS([getloadavg], [], 68AC_CHECK_FUNCS([getloadavg], [],
69 [gl_PREREQ_GETLOADAVG]) 69 [gl_PREREQ_GETLOADAVG])
70 70
71# Some definitions of getloadavg require that the program be installed setgid. 71# Some definitions of getloadavg require that the program be installed setgid.
72AC_CACHE_CHECK([whether getloadavg requires setgid], 72AC_CACHE_CHECK([whether getloadavg requires setgid],
73 gl_cv_func_getloadavg_setgid, 73 gl_cv_func_getloadavg_setgid,
74[AC_EGREP_CPP([Yowza Am I SETGID yet], 74[AC_EGREP_CPP([Yowza Am I SETGID yet],
75[#define CONFIGURING_GETLOADAVG 75[#define CONFIGURING_GETLOADAVG
76#include "$srcdir/$1/getloadavg.c" 76#include "$srcdir/$1/getloadavg.c"
@@ -78,13 +78,13 @@ AC_CACHE_CHECK([whether getloadavg requires setgid],
78Yowza Am I SETGID yet 78Yowza Am I SETGID yet
79#endif 79#endif
80], 80],
81 gl_cv_func_getloadavg_setgid=yes, 81 gl_cv_func_getloadavg_setgid=yes,
82 gl_cv_func_getloadavg_setgid=no)]) 82 gl_cv_func_getloadavg_setgid=no)])
83if test $gl_cv_func_getloadavg_setgid = yes; then 83if test $gl_cv_func_getloadavg_setgid = yes; then
84 NEED_SETGID=true 84 NEED_SETGID=true
85 AC_DEFINE([GETLOADAVG_PRIVILEGED], [1], 85 AC_DEFINE([GETLOADAVG_PRIVILEGED], [1],
86 [Define to 1 if the `getloadavg' function needs to be run setuid 86 [Define to 1 if the `getloadavg' function needs to be run setuid
87 or setgid.]) 87 or setgid.])
88else 88else
89 NEED_SETGID=false 89 NEED_SETGID=false
90fi 90fi
@@ -98,8 +98,8 @@ if test $gl_cv_func_getloadavg_setgid = yes; then
98 test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem` 98 test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
99 gl_cv_group_kmem=`echo $ac_ls_output \ 99 gl_cv_group_kmem=`echo $ac_ls_output \
100 | sed -ne ['s/[ ][ ]*/ /g 100 | sed -ne ['s/[ ][ ]*/ /g
101 s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/ 101 s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/
102 / /s/.* //;p']` 102 / /s/.* //;p']`
103]) 103])
104 AC_SUBST([KMEM_GROUP], [$gl_cv_group_kmem])dnl 104 AC_SUBST([KMEM_GROUP], [$gl_cv_group_kmem])dnl
105fi 105fi
@@ -154,8 +154,8 @@ if test $gl_have_func = no; then
154 [gl_have_func=yes 154 [gl_have_func=yes
155 AC_DEFINE([UMAX], [1], [Define to 1 for Encore UMAX.]) 155 AC_DEFINE([UMAX], [1], [Define to 1 for Encore UMAX.])
156 AC_DEFINE([UMAX4_3], [1], 156 AC_DEFINE([UMAX4_3], [1],
157 [Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h> 157 [Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h>
158 instead of <sys/cpustats.h>.])]) 158 instead of <sys/cpustats.h>.])])
159fi 159fi
160 160
161if test $gl_have_func = no; then 161if test $gl_have_func = no; then
@@ -169,10 +169,19 @@ fi
169 169
170AC_CHECK_HEADERS([nlist.h], 170AC_CHECK_HEADERS([nlist.h],
171[AC_CHECK_MEMBERS([struct nlist.n_un.n_name], 171[AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
172 [AC_DEFINE([NLIST_NAME_UNION], [1], 172 [AC_DEFINE([NLIST_NAME_UNION], [1],
173 [Define to 1 if your `struct nlist' has an 173 [Define to 1 if your `struct nlist' has an
174 `n_un' member. Obsolete, depend on 174 `n_un' member. Obsolete, depend on
175 `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [], 175 `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [],
176 [@%:@include <nlist.h>]) 176 [@%:@include <nlist.h>])
177 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
178 [[struct nlist x;
179 #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
180 x.n_un.n_name = "";
181 #else
182 x.n_name = "";
183 #endif]])],
184 [AC_DEFINE([N_NAME_POINTER], [1],
185 [Define to 1 if the nlist n_name member is a pointer])])
177])dnl 186])dnl
178])# gl_PREREQ_GETLOADAVG 187])# gl_PREREQ_GETLOADAVG
diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4
index 9b683c2..a19805e 100644
--- a/gl/m4/getopt.m4
+++ b/gl/m4/getopt.m4
@@ -1,82 +1,272 @@
1# getopt.m4 serial 14 1# getopt.m4 serial 24
2dnl Copyright (C) 2002-2006, 2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2006, 2008-2010 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# The getopt module assume you want GNU getopt, with getopt_long etc, 7# Request a POSIX compliant getopt function.
8# rather than vanilla POSIX getopt. This means your code should 8AC_DEFUN([gl_FUNC_GETOPT_POSIX],
9# always include <getopt.h> for the getopt prototypes. 9[
10 m4_divert_text([DEFAULTS], [gl_getopt_required=POSIX])
11 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
12 gl_GETOPT_IFELSE([
13 gl_REPLACE_GETOPT
14 ],
15 [])
16])
17
18# Request a POSIX compliant getopt function with GNU extensions (such as
19# options with optional arguments) and the functions getopt_long,
20# getopt_long_only.
21AC_DEFUN([gl_FUNC_GETOPT_GNU],
22[
23 m4_divert_text([INIT_PREPARE], [gl_getopt_required=GNU])
24
25 AC_REQUIRE([gl_FUNC_GETOPT_POSIX])
26])
10 27
11AC_DEFUN([gl_GETOPT_SUBSTITUTE], 28# Request the gnulib implementation of the getopt functions unconditionally.
29# argp.m4 uses this.
30AC_DEFUN([gl_REPLACE_GETOPT],
12[ 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.
13 AC_LIBOBJ([getopt]) 37 AC_LIBOBJ([getopt])
14 AC_LIBOBJ([getopt1]) 38 AC_LIBOBJ([getopt1])
15 gl_GETOPT_SUBSTITUTE_HEADER
16 gl_PREREQ_GETOPT 39 gl_PREREQ_GETOPT
17]) 40])
18 41
19AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], 42# emacs' configure.in uses this.
43AC_DEFUN([gl_GETOPT_IFELSE],
20[ 44[
21 GETOPT_H=getopt.h 45 AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
22 AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], 46 AS_IF([test -n "$gl_replace_getopt"], [$1], [$2])
23 [Define to rpl_ if the getopt replacement functions and variables
24 should be used.])
25 AC_SUBST([GETOPT_H])
26]) 47])
27 48
49# Determine whether to replace the entire getopt facility.
28AC_DEFUN([gl_GETOPT_CHECK_HEADERS], 50AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
29[ 51[
30 if test -z "$GETOPT_H"; then 52 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
31 AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h]) 53
54 dnl Persuade Solaris <unistd.h> to declare optarg, optind, opterr, optopt.
55 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
56
57 gl_CHECK_NEXT_HEADERS([getopt.h])
58 AC_CHECK_HEADERS_ONCE([getopt.h])
59 if test $ac_cv_header_getopt_h = yes; then
60 HAVE_GETOPT_H=1
61 else
62 HAVE_GETOPT_H=0
63 fi
64 AC_SUBST([HAVE_GETOPT_H])
65
66 gl_replace_getopt=
67
68 dnl Test whether <getopt.h> is available.
69 if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
70 AC_CHECK_HEADERS([getopt.h], [], [gl_replace_getopt=yes])
71 fi
72
73 dnl Test whether the function getopt_long is available.
74 if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
75 AC_CHECK_FUNCS([getopt_long_only], [], [gl_replace_getopt=yes])
32 fi 76 fi
33 77
34 if test -z "$GETOPT_H"; then 78 dnl BSD getopt_long uses an incompatible method to reset option processing.
35 AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h]) 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 if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
83 AC_CHECK_DECLS([optreset], [], [],
84 [[#include <getopt.h>]])
36 fi 85 fi
37 86
38 dnl BSD getopt_long uses an incompatible method to reset option processing, 87 dnl mingw's getopt (in libmingwex.a) does weird things when the options
39 dnl and (as of 2004-10-15) mishandles optional option-arguments. 88 dnl strings starts with '+' and it's not the first call. Some internal state
40 if test -z "$GETOPT_H"; then 89 dnl is left over from earlier calls, and neither setting optind = 0 nor
41 AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>]) 90 dnl setting optreset = 1 get rid of this internal state.
91 dnl POSIX is silent on optind vs. optreset, so we allow either behavior.
92 if test -z "$gl_replace_getopt"; then
93 AC_CACHE_CHECK([whether getopt is POSIX compatible],
94 [gl_cv_func_getopt_posix],
95 [
96 dnl This test fails on mingw and succeeds on all other platforms.
97 AC_RUN_IFELSE([AC_LANG_SOURCE([[
98#include <unistd.h>
99#include <stdlib.h>
100#include <string.h>
101
102#if !HAVE_DECL_OPTRESET
103# define OPTIND_MIN 0
104#else
105# define OPTIND_MIN 1
106#endif
107
108int
109main ()
110{
111 {
112 int argc = 0;
113 char *argv[10];
114 int c;
115
116 argv[argc++] = "program";
117 argv[argc++] = "-a";
118 argv[argc++] = "foo";
119 argv[argc++] = "bar";
120 argv[argc] = NULL;
121 optind = OPTIND_MIN;
122 opterr = 0;
123
124 c = getopt (argc, argv, "ab");
125 if (!(c == 'a'))
126 return 1;
127 c = getopt (argc, argv, "ab");
128 if (!(c == -1))
129 return 2;
130 if (!(optind == 2))
131 return 3;
132 }
133 /* Some internal state exists at this point. */
134 {
135 int argc = 0;
136 char *argv[10];
137 int c;
138
139 argv[argc++] = "program";
140 argv[argc++] = "donald";
141 argv[argc++] = "-p";
142 argv[argc++] = "billy";
143 argv[argc++] = "duck";
144 argv[argc++] = "-a";
145 argv[argc++] = "bar";
146 argv[argc] = NULL;
147 optind = OPTIND_MIN;
148 opterr = 0;
149
150 c = getopt (argc, argv, "+abp:q:");
151 if (!(c == -1))
152 return 4;
153 if (!(strcmp (argv[0], "program") == 0))
154 return 5;
155 if (!(strcmp (argv[1], "donald") == 0))
156 return 6;
157 if (!(strcmp (argv[2], "-p") == 0))
158 return 7;
159 if (!(strcmp (argv[3], "billy") == 0))
160 return 8;
161 if (!(strcmp (argv[4], "duck") == 0))
162 return 9;
163 if (!(strcmp (argv[5], "-a") == 0))
164 return 10;
165 if (!(strcmp (argv[6], "bar") == 0))
166 return 11;
167 if (!(optind == 1))
168 return 12;
169 }
170
171 return 0;
172}
173]])],
174 [gl_cv_func_getopt_posix=yes], [gl_cv_func_getopt_posix=no],
175 [case "$host_os" in
176 mingw*) gl_cv_func_getopt_posix="guessing no";;
177 *) gl_cv_func_getopt_posix="guessing yes";;
178 esac
179 ])
180 ])
181 case "$gl_cv_func_getopt_posix" in
182 *no) gl_replace_getopt=yes ;;
183 esac
42 fi 184 fi
43 185
44 dnl Solaris 10 getopt doesn't handle `+' as a leading character in an 186 if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
45 dnl option string (as of 2005-05-05). 187 AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_getopt_gnu],
46 if test -z "$GETOPT_H"; then 188 [# Even with POSIXLY_CORRECT, the GNU extension of leading '-' in the
47 AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt], 189 # optstring is necessary for programs like m4 that have POSIX-mandated
48 [AC_RUN_IFELSE( 190 # semantics for supporting options interspersed with files.
49 [AC_LANG_PROGRAM([[#include <getopt.h>]], 191 # Also, since getopt_long is a GNU extension, we require optind=0.
50 [[ 192 gl_had_POSIXLY_CORRECT=${POSIXLY_CORRECT:+yes}
51 char *myargv[3]; 193 POSIXLY_CORRECT=1
52 myargv[0] = "conftest"; 194 export POSIXLY_CORRECT
53 myargv[1] = "-+"; 195 AC_RUN_IFELSE(
54 myargv[2] = 0; 196 [AC_LANG_PROGRAM([[#include <getopt.h>
55 return getopt (2, myargv, "+a") != '?'; 197 #include <stddef.h>
56 ]])], 198 #include <string.h>
57 [gl_cv_func_gnu_getopt=yes], 199 ]], [[
58 [gl_cv_func_gnu_getopt=no], 200 /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw,
59 [dnl cross compiling - pessimistically guess based on decls 201 and fails on MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5,
60 dnl Solaris 10 getopt doesn't handle `+' as a leading character in an 202 OSF/1 5.1, Solaris 10. */
61 dnl option string (as of 2005-05-05). 203 {
62 AC_CHECK_DECL([getopt_clip], 204 char *myargv[3];
63 [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes], 205 myargv[0] = "conftest";
64 [#include <getopt.h>])])]) 206 myargv[1] = "-+";
65 if test "$gl_cv_func_gnu_getopt" = "no"; then 207 myargv[2] = 0;
66 GETOPT_H=getopt.h 208 opterr = 0;
209 if (getopt (2, myargv, "+a") != '?')
210 return 1;
211 }
212 /* This code succeeds on glibc 2.8, mingw,
213 and fails on MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11,
214 IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */
215 {
216 char *argv[] = { "program", "-p", "foo", "bar", NULL };
217
218 optind = 1;
219 if (getopt (4, argv, "p::") != 'p')
220 return 2;
221 if (optarg != NULL)
222 return 3;
223 if (getopt (4, argv, "p::") != -1)
224 return 4;
225 if (optind != 2)
226 return 5;
227 }
228 /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */
229 {
230 char *argv[] = { "program", "foo", "-p", NULL };
231 optind = 0;
232 if (getopt (3, argv, "-p") != 1)
233 return 6;
234 if (getopt (3, argv, "-p") != 'p')
235 return 7;
236 }
237 return 0;
238 ]])],
239 [gl_cv_func_getopt_gnu=yes],
240 [gl_cv_func_getopt_gnu=no],
241 [dnl Cross compiling. Guess based on host and declarations.
242 case $host_os:$ac_cv_have_decl_optreset in
243 *-gnu*:* | mingw*:*) gl_cv_func_getopt_gnu=no;;
244 *:yes) gl_cv_func_getopt_gnu=no;;
245 *) gl_cv_func_getopt_gnu=yes;;
246 esac
247 ])
248 if test "$gl_had_POSIXLY_CORRECT" != yes; then
249 AS_UNSET([POSIXLY_CORRECT])
250 fi
251 ])
252 if test "$gl_cv_func_getopt_gnu" = "no"; then
253 gl_replace_getopt=yes
67 fi 254 fi
68 fi 255 fi
69]) 256])
70 257
71AC_DEFUN([gl_GETOPT_IFELSE], 258# emacs' configure.in uses this.
259AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
72[ 260[
73 AC_REQUIRE([gl_GETOPT_CHECK_HEADERS]) 261 GETOPT_H=getopt.h
74 AS_IF([test -n "$GETOPT_H"], [$1], [$2]) 262 AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
263 [Define to rpl_ if the getopt replacement functions and variables
264 should be used.])
265 AC_SUBST([GETOPT_H])
75]) 266])
76 267
77AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])])
78
79# Prerequisites of lib/getopt*. 268# Prerequisites of lib/getopt*.
269# emacs' configure.in uses this.
80AC_DEFUN([gl_PREREQ_GETOPT], 270AC_DEFUN([gl_PREREQ_GETOPT],
81[ 271[
82 AC_CHECK_DECLS_ONCE([getenv]) 272 AC_CHECK_DECLS_ONCE([getenv])
diff --git a/gl/m4/gettext.m4 b/gl/m4/gettext.m4
index d90c850..d6dc3fe 100644
--- a/gl/m4/gettext.m4
+++ b/gl/m4/gettext.m4
@@ -1,5 +1,5 @@
1# gettext.m4 serial 62 (gettext-0.18) 1# gettext.m4 serial 62 (gettext-0.18)
2dnl Copyright (C) 1995-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 1995-2010 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/glibc2.m4 b/gl/m4/glibc2.m4
index fe58a0f..f148c12 100644
--- a/gl/m4/glibc2.m4
+++ b/gl/m4/glibc2.m4
@@ -1,5 +1,5 @@
1# glibc2.m4 serial 2 1# glibc2.m4 serial 2
2dnl Copyright (C) 2000-2002, 2004, 2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2004, 2008-2010 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,16 +12,16 @@ AC_DEFUN([gt_GLIBC2],
12 AC_CACHE_CHECK([whether we are using the GNU C Library 2 or newer], 12 AC_CACHE_CHECK([whether we are using the GNU C Library 2 or newer],
13 [ac_cv_gnu_library_2], 13 [ac_cv_gnu_library_2],
14 [AC_EGREP_CPP([Lucky GNU user], 14 [AC_EGREP_CPP([Lucky GNU user],
15 [ 15 [
16#include <features.h> 16#include <features.h>
17#ifdef __GNU_LIBRARY__ 17#ifdef __GNU_LIBRARY__
18 #if (__GLIBC__ >= 2) 18 #if (__GLIBC__ >= 2)
19 Lucky GNU user 19 Lucky GNU user
20 #endif 20 #endif
21#endif 21#endif
22 ], 22 ],
23 [ac_cv_gnu_library_2=yes], 23 [ac_cv_gnu_library_2=yes],
24 [ac_cv_gnu_library_2=no]) 24 [ac_cv_gnu_library_2=no])
25 ] 25 ]
26 ) 26 )
27 AC_SUBST([GLIBC2]) 27 AC_SUBST([GLIBC2])
diff --git a/gl/m4/glibc21.m4 b/gl/m4/glibc21.m4
index 93fbf47..68ada9d 100644
--- a/gl/m4/glibc21.m4
+++ b/gl/m4/glibc21.m4
@@ -1,5 +1,5 @@
1# glibc21.m4 serial 4 1# glibc21.m4 serial 4
2dnl Copyright (C) 2000-2002, 2004, 2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2004, 2008-2010 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,16 +12,16 @@ AC_DEFUN([gl_GLIBC21],
12 AC_CACHE_CHECK([whether we are using the GNU C Library 2.1 or newer], 12 AC_CACHE_CHECK([whether we are using the GNU C Library 2.1 or newer],
13 [ac_cv_gnu_library_2_1], 13 [ac_cv_gnu_library_2_1],
14 [AC_EGREP_CPP([Lucky GNU user], 14 [AC_EGREP_CPP([Lucky GNU user],
15 [ 15 [
16#include <features.h> 16#include <features.h>
17#ifdef __GNU_LIBRARY__ 17#ifdef __GNU_LIBRARY__
18 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) 18 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
19 Lucky GNU user 19 Lucky GNU user
20 #endif 20 #endif
21#endif 21#endif
22 ], 22 ],
23 [ac_cv_gnu_library_2_1=yes], 23 [ac_cv_gnu_library_2_1=yes],
24 [ac_cv_gnu_library_2_1=no]) 24 [ac_cv_gnu_library_2_1=no])
25 ] 25 ]
26 ) 26 )
27 AC_SUBST([GLIBC21]) 27 AC_SUBST([GLIBC21])
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
index 385f543..0ac6b96 100644
--- a/gl/m4/gnulib-cache.m4
+++ b/gl/m4/gnulib-cache.m4
@@ -1,4 +1,4 @@
1# Copyright (C) 2002-2009 Free Software Foundation, Inc. 1# Copyright (C) 2002-2010 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, distributed under the terms of the GNU
4# General Public License. As a special exception to the GNU General 4# General Public License. As a special exception to the GNU General
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4
index c8fda20..9cc519e 100644
--- a/gl/m4/gnulib-common.m4
+++ b/gl/m4/gnulib-common.m4
@@ -1,5 +1,5 @@
1# gnulib-common.m4 serial 11 1# gnulib-common.m4 serial 18
2dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2010 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.
@@ -23,23 +23,77 @@ AC_DEFUN([gl_COMMON_BODY], [
23# define __GNUC_STDC_INLINE__ 1 23# define __GNUC_STDC_INLINE__ 1
24#endif]) 24#endif])
25 AH_VERBATIM([unused_parameter], 25 AH_VERBATIM([unused_parameter],
26[/* Define as a marker that can be attached to function parameter declarations 26[/* Define as a marker that can be attached to declarations that might not
27 for parameters that are not used. This helps to reduce warnings, such as 27 be used. This helps to reduce warnings, such as from
28 from GCC -Wunused-parameter. */ 28 GCC -Wunused-parameter. */
29#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) 29#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
30# define _UNUSED_PARAMETER_ __attribute__ ((__unused__)) 30# define _GL_UNUSED __attribute__ ((__unused__))
31#else 31#else
32# define _UNUSED_PARAMETER_ 32# define _GL_UNUSED
33#endif 33#endif
34/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
35 is a misnomer outside of parameter lists. */
36#define _UNUSED_PARAMETER_ _GL_UNUSED
34]) 37])
35]) 38])
36 39
40# gl_MODULE_INDICATOR_CONDITION
41# expands to a C preprocessor expression that evaluates to 1 or 0, depending
42# whether a gnulib module that has been requested shall be considered present
43# or not.
44AC_DEFUN([gl_MODULE_INDICATOR_CONDITION], [1])
45
46# gl_MODULE_INDICATOR_SET_VARIABLE([modulename])
47# sets the shell variable that indicates the presence of the given module to
48# a C preprocessor expression that will evaluate to 1.
49AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE],
50[
51 GNULIB_[]m4_translit([[$1]],
52 [abcdefghijklmnopqrstuvwxyz./-],
53 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=gl_MODULE_INDICATOR_CONDITION
54])
55
37# gl_MODULE_INDICATOR([modulename]) 56# gl_MODULE_INDICATOR([modulename])
38# defines a C macro indicating the presence of the given module. 57# defines a C macro indicating the presence of the given module
58# in a location where it can be used.
59# | Value | Value |
60# | in lib/ | in tests/ |
61# --------------------------------------------+---------+-----------+
62# Module present among main modules: | 1 | 1 |
63# --------------------------------------------+---------+-----------+
64# Module present among tests-related modules: | 0 | 1 |
65# --------------------------------------------+---------+-----------+
66# Module not present at all: | 0 | 0 |
67# --------------------------------------------+---------+-----------+
39AC_DEFUN([gl_MODULE_INDICATOR], 68AC_DEFUN([gl_MODULE_INDICATOR],
40[ 69[
41 AC_DEFINE([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1], 70 AC_DEFINE_UNQUOTED([GNULIB_]m4_translit([[$1]],
42 [Define to 1 when using the gnulib module ]$1[.]) 71 [abcdefghijklmnopqrstuvwxyz./-],
72 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]),
73 [gl_MODULE_INDICATOR_CONDITION],
74 [Define to a C preprocessor expression that evaluates to 1 or 0,
75 depending whether the gnulib module $1 shall be considered present.])
76])
77
78# gl_MODULE_INDICATOR_FOR_TESTS([modulename])
79# defines a C macro indicating the presence of the given module
80# in lib or tests. This is useful to determine whether the module
81# should be tested.
82# | Value | Value |
83# | in lib/ | in tests/ |
84# --------------------------------------------+---------+-----------+
85# Module present among main modules: | 1 | 1 |
86# --------------------------------------------+---------+-----------+
87# Module present among tests-related modules: | 1 | 1 |
88# --------------------------------------------+---------+-----------+
89# Module not present at all: | 0 | 0 |
90# --------------------------------------------+---------+-----------+
91AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS],
92[
93 AC_DEFINE([GNULIB_TEST_]m4_translit([[$1]],
94 [abcdefghijklmnopqrstuvwxyz./-],
95 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1],
96 [Define to 1 when the gnulib module $1 should be tested.])
43]) 97])
44 98
45# m4_foreach_w 99# m4_foreach_w
@@ -49,10 +103,25 @@ m4_ifndef([m4_foreach_w],
49 [m4_define([m4_foreach_w], 103 [m4_define([m4_foreach_w],
50 [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) 104 [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
51 105
106# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH])
107# ----------------------------------------------------
108# Backport of autoconf-2.63b's macro.
109# Remove this macro when we can assume autoconf >= 2.64.
110m4_ifndef([AS_VAR_IF],
111[m4_define([AS_VAR_IF],
112[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])])
113
52# AC_PROG_MKDIR_P 114# AC_PROG_MKDIR_P
53# is a backport of autoconf-2.60's AC_PROG_MKDIR_P. 115# is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix
54# Remove this macro when we can assume autoconf >= 2.60. 116# for interoperability with automake-1.9.6 from autoconf-2.62.
55m4_ifdef([AC_PROG_MKDIR_P], [], [ 117# Remove this macro when we can assume autoconf >= 2.62 or
118# autoconf >= 2.60 && automake >= 1.10.
119m4_ifdef([AC_PROG_MKDIR_P], [
120 dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed.
121 m4_define([AC_PROG_MKDIR_P],
122 m4_defn([AC_PROG_MKDIR_P])[
123 AC_SUBST([MKDIR_P])])], [
124 dnl For autoconf < 2.60: Backport of AC_PROG_MKDIR_P.
56 AC_DEFUN_ONCE([AC_PROG_MKDIR_P], 125 AC_DEFUN_ONCE([AC_PROG_MKDIR_P],
57 [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake 126 [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
58 MKDIR_P='$(mkdir_p)' 127 MKDIR_P='$(mkdir_p)'
@@ -70,13 +139,13 @@ AC_DEFUN([AC_C_RESTRICT],
70 for ac_kw in __restrict __restrict__ _Restrict restrict; do 139 for ac_kw in __restrict __restrict__ _Restrict restrict; do
71 AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 140 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
72 [[typedef int * int_ptr; 141 [[typedef int * int_ptr;
73 int foo (int_ptr $ac_kw ip) { 142 int foo (int_ptr $ac_kw ip) {
74 return ip[0]; 143 return ip[0];
75 }]], 144 }]],
76 [[int s[1]; 145 [[int s[1];
77 int * $ac_kw t = s; 146 int * $ac_kw t = s;
78 t[0] = 0; 147 t[0] = 0;
79 return foo(t)]])], 148 return foo(t)]])],
80 [ac_cv_c_restrict=$ac_kw]) 149 [ac_cv_c_restrict=$ac_kw])
81 test "$ac_cv_c_restrict" != no && break 150 test "$ac_cv_c_restrict" != no && break
82 done 151 done
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index 005cc4e..4a956e4 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -1,5 +1,5 @@
1# DO NOT EDIT! GENERATED AUTOMATICALLY! 1# DO NOT EDIT! GENERATED AUTOMATICALLY!
2# Copyright (C) 2002-2009 Free Software Foundation, Inc. 2# Copyright (C) 2002-2010 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, distributed under the terms of the GNU
5# General Public License. As a special exception to the GNU General 5# General Public License. As a special exception to the GNU General
@@ -25,7 +25,108 @@ AC_DEFUN([gl_EARLY],
25 m4_pattern_allow([^gl_LIBOBJS$])dnl a variable 25 m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
26 m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable 26 m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
27 AC_REQUIRE([AC_PROG_RANLIB]) 27 AC_REQUIRE([AC_PROG_RANLIB])
28 # Code from module alignof:
29 # Code from module alloca:
30 # Code from module alloca-opt:
31 # Code from module arg-nonnull:
32 # Code from module arpa_inet:
33 # Code from module base64:
34 # Code from module btowc:
35 # Code from module c++defs:
36 # Code from module c-strtod:
37 # Code from module cloexec:
38 # Code from module close-hook:
39 # Code from module configmake:
40 # Code from module dirname:
41 # Code from module dirname-lgpl:
42 # Code from module double-slash-root:
43 # Code from module dup2:
44 # Code from module errno:
45 # Code from module error:
46 # Code from module exitfail:
47 # Code from module extensions:
28 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 48 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
49 # Code from module fcntl:
50 # Code from module fcntl-h:
51 # Code from module fcntl-safer:
52 # Code from module float:
53 # Code from module floorf:
54 # Code from module fsusage:
55 # Code from module full-read:
56 # Code from module full-write:
57 # Code from module getaddrinfo:
58 # Code from module getdtablesize:
59 # Code from module gethostname:
60 # Code from module getloadavg:
61 # Code from module getopt:
62 # Code from module getopt-gnu:
63 # Code from module getopt-posix:
64 # Code from module gettext:
65 # Code from module gettext-h:
66 # Code from module havelib:
67 # Code from module hostent:
68 # Code from module include_next:
69 # Code from module inet_ntop:
70 # Code from module inline:
71 # Code from module intprops:
72 # Code from module langinfo:
73 # Code from module localcharset:
74 # Code from module locale:
75 # Code from module malloc:
76 # Code from module malloc-posix:
77 # Code from module math:
78 # Code from module mbrtowc:
79 # Code from module mbsinit:
80 # Code from module memchr:
81 # Code from module mktime:
82 # Code from module mountlist:
83 # Code from module multiarch:
84 # Code from module netdb:
85 # Code from module netinet_in:
86 # Code from module nl_langinfo:
87 # Code from module open:
88 # Code from module regex:
89 # Code from module safe-read:
90 # Code from module safe-write:
91 # Code from module servent:
92 # Code from module size_max:
93 # Code from module snprintf:
94 # Code from module sockets:
95 # Code from module socklen:
96 # Code from module ssize_t:
97 # Code from module stat:
98 # Code from module stdbool:
99 # Code from module stddef:
100 # Code from module stdint:
101 # Code from module stdio:
102 # Code from module stdlib:
103 # Code from module strdup-posix:
104 # Code from module streq:
105 # Code from module strerror:
106 # Code from module string:
107 # Code from module strndup:
108 # Code from module strnlen:
109 # Code from module strstr-simple:
110 # Code from module sys_socket:
111 # Code from module sys_stat:
112 # Code from module time:
113 # Code from module time_r:
114 # Code from module timegm:
115 # Code from module unistd:
116 # Code from module unistd-safer:
117 # Code from module vasnprintf:
118 # Code from module vasprintf:
119 # Code from module verify:
120 # Code from module vsnprintf:
121 # Code from module warn-on-use:
122 # Code from module wchar:
123 # Code from module wcrtomb:
124 # Code from module wctype:
125 # Code from module write:
126 # Code from module xalloc:
127 # Code from module xalloc-die:
128 # Code from module xsize:
129 # Code from module xstrndup:
29]) 130])
30 131
31# This macro should be invoked from ./configure.in, in the section 132# This macro should be invoked from ./configure.in, in the section
@@ -36,6 +137,7 @@ AC_DEFUN([gl_INIT],
36 gl_cond_libtool=false 137 gl_cond_libtool=false
37 gl_libdeps= 138 gl_libdeps=
38 gl_ltlibdeps= 139 gl_ltlibdeps=
140 gl_m4_base='gl/m4'
39 m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ])) 141 m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
40 m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS])) 142 m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
41 m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) 143 m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
@@ -43,111 +145,239 @@ AC_DEFUN([gl_INIT],
43 m4_pushdef([gl_LIBSOURCES_DIR], []) 145 m4_pushdef([gl_LIBSOURCES_DIR], [])
44 gl_COMMON 146 gl_COMMON
45 gl_source_base='gl' 147 gl_source_base='gl'
148 # Code from module alignof:
149 # Code from module alloca:
150 # Code from module alloca-opt:
46 gl_FUNC_ALLOCA 151 gl_FUNC_ALLOCA
152 # Code from module arg-nonnull:
153 # Code from module arpa_inet:
47 gl_HEADER_ARPA_INET 154 gl_HEADER_ARPA_INET
48 AC_PROG_MKDIR_P 155 AC_PROG_MKDIR_P
156 # Code from module base64:
49 gl_FUNC_BASE64 157 gl_FUNC_BASE64
158 # Code from module btowc:
50 gl_FUNC_BTOWC 159 gl_FUNC_BTOWC
51 gl_WCHAR_MODULE_INDICATOR([btowc]) 160 gl_WCHAR_MODULE_INDICATOR([btowc])
161 # Code from module c++defs:
162 # Code from module c-strtod:
52 gl_C_STRTOD 163 gl_C_STRTOD
164 # Code from module cloexec:
53 gl_CLOEXEC 165 gl_CLOEXEC
166 gl_MODULE_INDICATOR_FOR_TESTS([cloexec])
167 # Code from module close-hook:
168 # Code from module configmake:
169 # Code from module dirname:
54 gl_DIRNAME 170 gl_DIRNAME
171 gl_MODULE_INDICATOR([dirname])
172 # Code from module dirname-lgpl:
173 gl_DIRNAME_LGPL
174 # Code from module double-slash-root:
55 gl_DOUBLE_SLASH_ROOT 175 gl_DOUBLE_SLASH_ROOT
176 # Code from module dup2:
177 gl_FUNC_DUP2
178 gl_UNISTD_MODULE_INDICATOR([dup2])
179 # Code from module errno:
56 gl_HEADER_ERRNO_H 180 gl_HEADER_ERRNO_H
181 # Code from module error:
57 gl_ERROR 182 gl_ERROR
58 m4_ifdef([AM_XGETTEXT_OPTION], 183 m4_ifdef([AM_XGETTEXT_OPTION],
59 [AM_XGETTEXT_OPTION([--flag=error:3:c-format]) 184 [AM_][XGETTEXT_OPTION([--flag=error:3:c-format])
60 AM_XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) 185 AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])])
61 gl_EXITFAIL 186 # Code from module exitfail:
187 # Code from module extensions:
188 # Code from module fcntl:
189 gl_FUNC_FCNTL
190 gl_FCNTL_MODULE_INDICATOR([fcntl])
191 # Code from module fcntl-h:
62 gl_FCNTL_H 192 gl_FCNTL_H
193 # Code from module fcntl-safer:
63 gl_FCNTL_SAFER 194 gl_FCNTL_SAFER
64 gl_MODULE_INDICATOR([fcntl-safer]) 195 gl_MODULE_INDICATOR([fcntl-safer])
196 # Code from module float:
65 gl_FLOAT_H 197 gl_FLOAT_H
198 # Code from module floorf:
66 gl_FUNC_FLOORF 199 gl_FUNC_FLOORF
67 gl_MATH_MODULE_INDICATOR([floorf]) 200 gl_MATH_MODULE_INDICATOR([floorf])
201 # Code from module fsusage:
68 gl_FSUSAGE 202 gl_FSUSAGE
203 # Code from module full-read:
204 # Code from module full-write:
205 # Code from module getaddrinfo:
69 gl_GETADDRINFO 206 gl_GETADDRINFO
70 gl_NETDB_MODULE_INDICATOR([getaddrinfo]) 207 gl_NETDB_MODULE_INDICATOR([getaddrinfo])
208 # Code from module getdtablesize:
209 gl_FUNC_GETDTABLESIZE
210 gl_UNISTD_MODULE_INDICATOR([getdtablesize])
211 # Code from module gethostname:
71 gl_FUNC_GETHOSTNAME 212 gl_FUNC_GETHOSTNAME
72 gl_UNISTD_MODULE_INDICATOR([gethostname]) 213 gl_UNISTD_MODULE_INDICATOR([gethostname])
214 # Code from module getloadavg:
73 gl_GETLOADAVG([$gl_source_base]) 215 gl_GETLOADAVG([$gl_source_base])
74 gl_STDLIB_MODULE_INDICATOR([getloadavg]) 216 gl_STDLIB_MODULE_INDICATOR([getloadavg])
75 gl_GETOPT 217 # Code from module getopt:
218 # Code from module getopt-gnu:
219 gl_FUNC_GETOPT_GNU
220 gl_MODULE_INDICATOR_FOR_TESTS([getopt-gnu])
221 # Code from module getopt-posix:
222 gl_FUNC_GETOPT_POSIX
223 # Code from module gettext:
76 dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac. 224 dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac.
77 AM_GNU_GETTEXT_VERSION([0.17]) 225 AM_GNU_GETTEXT_VERSION([0.17])
226 # Code from module gettext-h:
78 AC_SUBST([LIBINTL]) 227 AC_SUBST([LIBINTL])
79 AC_SUBST([LTLIBINTL]) 228 AC_SUBST([LTLIBINTL])
229 # Code from module havelib:
230 # Code from module hostent:
80 gl_HOSTENT 231 gl_HOSTENT
81 gl_INET_NTOP 232 # Code from module include_next:
233 # Code from module inet_ntop:
234 gl_FUNC_INET_NTOP
82 gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) 235 gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
236 # Code from module inline:
83 gl_INLINE 237 gl_INLINE
238 # Code from module intprops:
239 # Code from module langinfo:
240 gl_LANGINFO_H
241 # Code from module localcharset:
84 gl_LOCALCHARSET 242 gl_LOCALCHARSET
85 LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\"" 243 LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\""
86 AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) 244 AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT])
245 # Code from module locale:
246 gl_LOCALE_H
247 # Code from module malloc:
87 AC_FUNC_MALLOC 248 AC_FUNC_MALLOC
88 AC_DEFINE([GNULIB_MALLOC_GNU], 1, [Define to indicate the 'malloc' module.]) 249 AC_DEFINE([GNULIB_MALLOC_GNU], 1, [Define to indicate the 'malloc' module.])
250 # Code from module malloc-posix:
89 gl_FUNC_MALLOC_POSIX 251 gl_FUNC_MALLOC_POSIX
90 gl_STDLIB_MODULE_INDICATOR([malloc-posix]) 252 gl_STDLIB_MODULE_INDICATOR([malloc-posix])
253 # Code from module math:
91 gl_MATH_H 254 gl_MATH_H
255 # Code from module mbrtowc:
92 gl_FUNC_MBRTOWC 256 gl_FUNC_MBRTOWC
93 gl_WCHAR_MODULE_INDICATOR([mbrtowc]) 257 gl_WCHAR_MODULE_INDICATOR([mbrtowc])
258 # Code from module mbsinit:
94 gl_FUNC_MBSINIT 259 gl_FUNC_MBSINIT
95 gl_WCHAR_MODULE_INDICATOR([mbsinit]) 260 gl_WCHAR_MODULE_INDICATOR([mbsinit])
261 # Code from module memchr:
262 gl_FUNC_MEMCHR
263 gl_STRING_MODULE_INDICATOR([memchr])
264 # Code from module mktime:
96 gl_FUNC_MKTIME 265 gl_FUNC_MKTIME
266 gl_TIME_MODULE_INDICATOR([mktime])
267 # Code from module mountlist:
97 gl_MOUNTLIST 268 gl_MOUNTLIST
269 # Code from module multiarch:
98 gl_MULTIARCH 270 gl_MULTIARCH
271 # Code from module netdb:
99 gl_HEADER_NETDB 272 gl_HEADER_NETDB
273 # Code from module netinet_in:
100 gl_HEADER_NETINET_IN 274 gl_HEADER_NETINET_IN
101 AC_PROG_MKDIR_P 275 AC_PROG_MKDIR_P
276 # Code from module nl_langinfo:
277 gl_FUNC_NL_LANGINFO
278 gl_LANGINFO_MODULE_INDICATOR([nl_langinfo])
279 # Code from module open:
102 gl_FUNC_OPEN 280 gl_FUNC_OPEN
103 gl_MODULE_INDICATOR([open])
104 gl_FCNTL_MODULE_INDICATOR([open]) 281 gl_FCNTL_MODULE_INDICATOR([open])
282 # Code from module regex:
105 gl_REGEX 283 gl_REGEX
284 # Code from module safe-read:
106 gl_SAFE_READ 285 gl_SAFE_READ
286 # Code from module safe-write:
107 gl_SAFE_WRITE 287 gl_SAFE_WRITE
288 # Code from module servent:
108 gl_SERVENT 289 gl_SERVENT
290 # Code from module size_max:
109 gl_SIZE_MAX 291 gl_SIZE_MAX
292 # Code from module snprintf:
110 gl_FUNC_SNPRINTF 293 gl_FUNC_SNPRINTF
111 gl_STDIO_MODULE_INDICATOR([snprintf]) 294 gl_STDIO_MODULE_INDICATOR([snprintf])
295 # Code from module sockets:
296 gl_SOCKETS
297 # Code from module socklen:
112 gl_TYPE_SOCKLEN_T 298 gl_TYPE_SOCKLEN_T
299 # Code from module ssize_t:
113 gt_TYPE_SSIZE_T 300 gt_TYPE_SSIZE_T
301 # Code from module stat:
302 gl_FUNC_STAT
303 gl_SYS_STAT_MODULE_INDICATOR([stat])
304 # Code from module stdbool:
114 AM_STDBOOL_H 305 AM_STDBOOL_H
306 # Code from module stddef:
307 gl_STDDEF_H
308 # Code from module stdint:
115 gl_STDINT_H 309 gl_STDINT_H
310 # Code from module stdio:
116 gl_STDIO_H 311 gl_STDIO_H
312 # Code from module stdlib:
117 gl_STDLIB_H 313 gl_STDLIB_H
314 # Code from module strdup-posix:
118 gl_FUNC_STRDUP_POSIX 315 gl_FUNC_STRDUP_POSIX
119 gl_STRING_MODULE_INDICATOR([strdup]) 316 gl_STRING_MODULE_INDICATOR([strdup])
317 # Code from module streq:
318 # Code from module strerror:
120 gl_FUNC_STRERROR 319 gl_FUNC_STRERROR
121 gl_STRING_MODULE_INDICATOR([strerror]) 320 gl_STRING_MODULE_INDICATOR([strerror])
321 # Code from module string:
122 gl_HEADER_STRING_H 322 gl_HEADER_STRING_H
323 # Code from module strndup:
123 gl_FUNC_STRNDUP 324 gl_FUNC_STRNDUP
124 gl_STRING_MODULE_INDICATOR([strndup]) 325 gl_STRING_MODULE_INDICATOR([strndup])
326 # Code from module strnlen:
125 gl_FUNC_STRNLEN 327 gl_FUNC_STRNLEN
126 gl_STRING_MODULE_INDICATOR([strnlen]) 328 gl_STRING_MODULE_INDICATOR([strnlen])
329 # Code from module strstr-simple:
330 gl_FUNC_STRSTR_SIMPLE
331 gl_STRING_MODULE_INDICATOR([strstr])
332 # Code from module sys_socket:
127 gl_HEADER_SYS_SOCKET 333 gl_HEADER_SYS_SOCKET
128 AC_PROG_MKDIR_P 334 AC_PROG_MKDIR_P
335 # Code from module sys_stat:
336 gl_HEADER_SYS_STAT_H
337 AC_PROG_MKDIR_P
338 # Code from module time:
129 gl_HEADER_TIME_H 339 gl_HEADER_TIME_H
340 # Code from module time_r:
130 gl_TIME_R 341 gl_TIME_R
342 gl_TIME_MODULE_INDICATOR([time_r])
343 # Code from module timegm:
131 gl_FUNC_TIMEGM 344 gl_FUNC_TIMEGM
345 gl_TIME_MODULE_INDICATOR([timegm])
346 # Code from module unistd:
132 gl_UNISTD_H 347 gl_UNISTD_H
348 # Code from module unistd-safer:
133 gl_UNISTD_SAFER 349 gl_UNISTD_SAFER
350 # Code from module vasnprintf:
134 gl_FUNC_VASNPRINTF 351 gl_FUNC_VASNPRINTF
352 # Code from module vasprintf:
135 gl_FUNC_VASPRINTF 353 gl_FUNC_VASPRINTF
136 gl_STDIO_MODULE_INDICATOR([vasprintf]) 354 gl_STDIO_MODULE_INDICATOR([vasprintf])
137 m4_ifdef([AM_XGETTEXT_OPTION], 355 m4_ifdef([AM_XGETTEXT_OPTION],
138 [AM_XGETTEXT_OPTION([--flag=asprintf:2:c-format]) 356 [AM_][XGETTEXT_OPTION([--flag=asprintf:2:c-format])
139 AM_XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) 357 AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])])
358 # Code from module verify:
359 # Code from module vsnprintf:
140 gl_FUNC_VSNPRINTF 360 gl_FUNC_VSNPRINTF
141 gl_STDIO_MODULE_INDICATOR([vsnprintf]) 361 gl_STDIO_MODULE_INDICATOR([vsnprintf])
362 # Code from module warn-on-use:
363 # Code from module wchar:
142 gl_WCHAR_H 364 gl_WCHAR_H
365 # Code from module wcrtomb:
143 gl_FUNC_WCRTOMB 366 gl_FUNC_WCRTOMB
144 gl_WCHAR_MODULE_INDICATOR([wcrtomb]) 367 gl_WCHAR_MODULE_INDICATOR([wcrtomb])
368 # Code from module wctype:
145 gl_WCTYPE_H 369 gl_WCTYPE_H
370 # Code from module write:
146 gl_FUNC_WRITE 371 gl_FUNC_WRITE
147 gl_UNISTD_MODULE_INDICATOR([write]) 372 gl_UNISTD_MODULE_INDICATOR([write])
373 # Code from module xalloc:
148 gl_XALLOC 374 gl_XALLOC
375 # Code from module xalloc-die:
376 # Code from module xsize:
149 gl_XSIZE 377 gl_XSIZE
378 # Code from module xstrndup:
150 gl_XSTRNDUP 379 gl_XSTRNDUP
380 # End of code from modules
151 m4_ifval(gl_LIBSOURCES_LIST, [ 381 m4_ifval(gl_LIBSOURCES_LIST, [
152 m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || 382 m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ ||
153 for gl_file in ]gl_LIBSOURCES_LIST[ ; do 383 for gl_file in ]gl_LIBSOURCES_LIST[ ; do
@@ -170,7 +400,7 @@ AC_DEFUN([gl_INIT],
170 if test -n "$gl_LIBOBJS"; then 400 if test -n "$gl_LIBOBJS"; then
171 # Remove the extension. 401 # Remove the extension.
172 sed_drop_objext='s/\.o$//;s/\.obj$//' 402 sed_drop_objext='s/\.o$//;s/\.obj$//'
173 for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do 403 for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
174 gl_libobjs="$gl_libobjs $i.$ac_objext" 404 gl_libobjs="$gl_libobjs $i.$ac_objext"
175 gl_ltlibobjs="$gl_ltlibobjs $i.lo" 405 gl_ltlibobjs="$gl_ltlibobjs $i.lo"
176 done 406 done
@@ -187,6 +417,13 @@ AC_DEFUN([gl_INIT],
187 m4_pushdef([gltests_LIBSOURCES_DIR], []) 417 m4_pushdef([gltests_LIBSOURCES_DIR], [])
188 gl_COMMON 418 gl_COMMON
189 gl_source_base='tests' 419 gl_source_base='tests'
420changequote(,)dnl
421 gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS
422changequote([, ])dnl
423 AC_SUBST([gltests_WITNESS])
424 gl_module_indicator_condition=$gltests_WITNESS
425 m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition])
426 m4_popdef([gl_MODULE_INDICATOR_CONDITION])
190 m4_ifval(gltests_LIBSOURCES_LIST, [ 427 m4_ifval(gltests_LIBSOURCES_LIST, [
191 m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ || 428 m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ ||
192 for gl_file in ]gltests_LIBSOURCES_LIST[ ; do 429 for gl_file in ]gltests_LIBSOURCES_LIST[ ; do
@@ -209,7 +446,7 @@ AC_DEFUN([gl_INIT],
209 if test -n "$gltests_LIBOBJS"; then 446 if test -n "$gltests_LIBOBJS"; then
210 # Remove the extension. 447 # Remove the extension.
211 sed_drop_objext='s/\.o$//;s/\.obj$//' 448 sed_drop_objext='s/\.o$//;s/\.obj$//'
212 for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do 449 for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
213 gltests_libobjs="$gltests_libobjs $i.$ac_objext" 450 gltests_libobjs="$gltests_libobjs $i.$ac_objext"
214 gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" 451 gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
215 done 452 done
@@ -280,8 +517,10 @@ AC_DEFUN([gltests_LIBSOURCES], [
280# This macro records the list of files which have been installed by 517# This macro records the list of files which have been installed by
281# gnulib-tool and may be removed by future gnulib-tool invocations. 518# gnulib-tool and may be removed by future gnulib-tool invocations.
282AC_DEFUN([gl_FILE_LIST], [ 519AC_DEFUN([gl_FILE_LIST], [
520 build-aux/arg-nonnull.h
521 build-aux/c++defs.h
283 build-aux/config.rpath 522 build-aux/config.rpath
284 build-aux/link-warning.h 523 build-aux/warn-on-use.h
285 lib/alignof.h 524 lib/alignof.h
286 lib/alloca.c 525 lib/alloca.c
287 lib/alloca.in.h 526 lib/alloca.in.h
@@ -290,17 +529,22 @@ AC_DEFUN([gl_FILE_LIST], [
290 lib/asprintf.c 529 lib/asprintf.c
291 lib/base64.c 530 lib/base64.c
292 lib/base64.h 531 lib/base64.h
532 lib/basename-lgpl.c
293 lib/basename.c 533 lib/basename.c
294 lib/btowc.c 534 lib/btowc.c
295 lib/c-strtod.c 535 lib/c-strtod.c
296 lib/c-strtod.h 536 lib/c-strtod.h
297 lib/cloexec.c 537 lib/cloexec.c
298 lib/cloexec.h 538 lib/cloexec.h
539 lib/close-hook.c
540 lib/close-hook.h
299 lib/config.charset 541 lib/config.charset
300 lib/creat-safer.c 542 lib/creat-safer.c
543 lib/dirname-lgpl.c
301 lib/dirname.c 544 lib/dirname.c
302 lib/dirname.h 545 lib/dirname.h
303 lib/dup-safer.c 546 lib/dup-safer.c
547 lib/dup2.c
304 lib/errno.in.h 548 lib/errno.in.h
305 lib/error.c 549 lib/error.c
306 lib/error.h 550 lib/error.h
@@ -308,6 +552,7 @@ AC_DEFUN([gl_FILE_LIST], [
308 lib/exitfail.h 552 lib/exitfail.h
309 lib/fcntl--.h 553 lib/fcntl--.h
310 lib/fcntl-safer.h 554 lib/fcntl-safer.h
555 lib/fcntl.c
311 lib/fcntl.in.h 556 lib/fcntl.in.h
312 lib/fd-safer.c 557 lib/fd-safer.c
313 lib/float+.h 558 lib/float+.h
@@ -322,6 +567,7 @@ AC_DEFUN([gl_FILE_LIST], [
322 lib/full-write.h 567 lib/full-write.h
323 lib/gai_strerror.c 568 lib/gai_strerror.c
324 lib/getaddrinfo.c 569 lib/getaddrinfo.c
570 lib/getdtablesize.c
325 lib/gethostname.c 571 lib/gethostname.c
326 lib/getloadavg.c 572 lib/getloadavg.c
327 lib/getopt.c 573 lib/getopt.c
@@ -331,17 +577,23 @@ AC_DEFUN([gl_FILE_LIST], [
331 lib/gettext.h 577 lib/gettext.h
332 lib/inet_ntop.c 578 lib/inet_ntop.c
333 lib/intprops.h 579 lib/intprops.h
580 lib/langinfo.in.h
334 lib/localcharset.c 581 lib/localcharset.c
335 lib/localcharset.h 582 lib/localcharset.h
583 lib/locale.in.h
336 lib/malloc.c 584 lib/malloc.c
337 lib/math.in.h 585 lib/math.in.h
338 lib/mbrtowc.c 586 lib/mbrtowc.c
339 lib/mbsinit.c 587 lib/mbsinit.c
588 lib/memchr.c
589 lib/memchr.valgrind
590 lib/mktime-internal.h
340 lib/mktime.c 591 lib/mktime.c
341 lib/mountlist.c 592 lib/mountlist.c
342 lib/mountlist.h 593 lib/mountlist.h
343 lib/netdb.in.h 594 lib/netdb.in.h
344 lib/netinet_in.in.h 595 lib/netinet_in.in.h
596 lib/nl_langinfo.c
345 lib/open-safer.c 597 lib/open-safer.c
346 lib/open.c 598 lib/open.c
347 lib/pipe-safer.c 599 lib/pipe-safer.c
@@ -363,11 +615,16 @@ AC_DEFUN([gl_FILE_LIST], [
363 lib/safe-write.h 615 lib/safe-write.h
364 lib/size_max.h 616 lib/size_max.h
365 lib/snprintf.c 617 lib/snprintf.c
618 lib/sockets.c
619 lib/sockets.h
620 lib/stat.c
366 lib/stdbool.in.h 621 lib/stdbool.in.h
622 lib/stddef.in.h
367 lib/stdint.in.h 623 lib/stdint.in.h
368 lib/stdio-write.c 624 lib/stdio-write.c
369 lib/stdio.in.h 625 lib/stdio.in.h
370 lib/stdlib.in.h 626 lib/stdlib.in.h
627 lib/str-two-way.h
371 lib/strdup.c 628 lib/strdup.c
372 lib/streq.h 629 lib/streq.h
373 lib/strerror.c 630 lib/strerror.c
@@ -375,7 +632,9 @@ AC_DEFUN([gl_FILE_LIST], [
375 lib/stripslash.c 632 lib/stripslash.c
376 lib/strndup.c 633 lib/strndup.c
377 lib/strnlen.c 634 lib/strnlen.c
635 lib/strstr.c
378 lib/sys_socket.in.h 636 lib/sys_socket.in.h
637 lib/sys_stat.in.h
379 lib/time.in.h 638 lib/time.in.h
380 lib/time_r.c 639 lib/time_r.c
381 lib/timegm.c 640 lib/timegm.c
@@ -387,6 +646,7 @@ AC_DEFUN([gl_FILE_LIST], [
387 lib/vasprintf.c 646 lib/vasprintf.c
388 lib/verify.h 647 lib/verify.h
389 lib/vsnprintf.c 648 lib/vsnprintf.c
649 lib/w32sock.h
390 lib/wchar.in.h 650 lib/wchar.in.h
391 lib/wcrtomb.c 651 lib/wcrtomb.c
392 lib/wctype.in.h 652 lib/wctype.in.h
@@ -408,17 +668,20 @@ AC_DEFUN([gl_FILE_LIST], [
408 m4/dirname.m4 668 m4/dirname.m4
409 m4/dos.m4 669 m4/dos.m4
410 m4/double-slash-root.m4 670 m4/double-slash-root.m4
671 m4/dup2.m4
411 m4/errno_h.m4 672 m4/errno_h.m4
412 m4/error.m4 673 m4/error.m4
413 m4/exitfail.m4
414 m4/extensions.m4 674 m4/extensions.m4
675 m4/fcntl-o.m4
415 m4/fcntl-safer.m4 676 m4/fcntl-safer.m4
677 m4/fcntl.m4
416 m4/fcntl_h.m4 678 m4/fcntl_h.m4
417 m4/float_h.m4 679 m4/float_h.m4
418 m4/floorf.m4 680 m4/floorf.m4
419 m4/fstypename.m4 681 m4/fstypename.m4
420 m4/fsusage.m4 682 m4/fsusage.m4
421 m4/getaddrinfo.m4 683 m4/getaddrinfo.m4
684 m4/getdtablesize.m4
422 m4/gethostname.m4 685 m4/gethostname.m4
423 m4/getloadavg.m4 686 m4/getloadavg.m4
424 m4/getopt.m4 687 m4/getopt.m4
@@ -439,6 +702,7 @@ AC_DEFUN([gl_FILE_LIST], [
439 m4/intmax_t.m4 702 m4/intmax_t.m4
440 m4/inttypes-pri.m4 703 m4/inttypes-pri.m4
441 m4/inttypes_h.m4 704 m4/inttypes_h.m4
705 m4/langinfo_h.m4
442 m4/lcmessage.m4 706 m4/lcmessage.m4
443 m4/lib-ld.m4 707 m4/lib-ld.m4
444 m4/lib-link.m4 708 m4/lib-link.m4
@@ -447,6 +711,7 @@ AC_DEFUN([gl_FILE_LIST], [
447 m4/locale-fr.m4 711 m4/locale-fr.m4
448 m4/locale-ja.m4 712 m4/locale-ja.m4
449 m4/locale-zh.m4 713 m4/locale-zh.m4
714 m4/locale_h.m4
450 m4/lock.m4 715 m4/lock.m4
451 m4/longlong.m4 716 m4/longlong.m4
452 m4/ls-mntd-fs.m4 717 m4/ls-mntd-fs.m4
@@ -455,11 +720,15 @@ AC_DEFUN([gl_FILE_LIST], [
455 m4/mbrtowc.m4 720 m4/mbrtowc.m4
456 m4/mbsinit.m4 721 m4/mbsinit.m4
457 m4/mbstate_t.m4 722 m4/mbstate_t.m4
723 m4/memchr.m4
458 m4/mktime.m4 724 m4/mktime.m4
725 m4/mmap-anon.m4
726 m4/mode_t.m4
459 m4/mountlist.m4 727 m4/mountlist.m4
460 m4/multiarch.m4 728 m4/multiarch.m4
461 m4/netdb_h.m4 729 m4/netdb_h.m4
462 m4/netinet_in_h.m4 730 m4/netinet_in_h.m4
731 m4/nl_langinfo.m4
463 m4/nls.m4 732 m4/nls.m4
464 m4/onceonly.m4 733 m4/onceonly.m4
465 m4/open.m4 734 m4/open.m4
@@ -473,10 +742,13 @@ AC_DEFUN([gl_FILE_LIST], [
473 m4/servent.m4 742 m4/servent.m4
474 m4/size_max.m4 743 m4/size_max.m4
475 m4/snprintf.m4 744 m4/snprintf.m4
745 m4/sockets.m4
476 m4/socklen.m4 746 m4/socklen.m4
477 m4/sockpfaf.m4 747 m4/sockpfaf.m4
478 m4/ssize_t.m4 748 m4/ssize_t.m4
749 m4/stat.m4
479 m4/stdbool.m4 750 m4/stdbool.m4
751 m4/stddef_h.m4
480 m4/stdint.m4 752 m4/stdint.m4
481 m4/stdint_h.m4 753 m4/stdint_h.m4
482 m4/stdio_h.m4 754 m4/stdio_h.m4
@@ -486,7 +758,9 @@ AC_DEFUN([gl_FILE_LIST], [
486 m4/string_h.m4 758 m4/string_h.m4
487 m4/strndup.m4 759 m4/strndup.m4
488 m4/strnlen.m4 760 m4/strnlen.m4
761 m4/strstr.m4
489 m4/sys_socket_h.m4 762 m4/sys_socket_h.m4
763 m4/sys_stat_h.m4
490 m4/threadlib.m4 764 m4/threadlib.m4
491 m4/time_h.m4 765 m4/time_h.m4
492 m4/time_r.m4 766 m4/time_r.m4
@@ -498,10 +772,11 @@ AC_DEFUN([gl_FILE_LIST], [
498 m4/vasprintf.m4 772 m4/vasprintf.m4
499 m4/visibility.m4 773 m4/visibility.m4
500 m4/vsnprintf.m4 774 m4/vsnprintf.m4
501 m4/wchar.m4 775 m4/warn-on-use.m4
776 m4/wchar_h.m4
502 m4/wchar_t.m4 777 m4/wchar_t.m4
503 m4/wcrtomb.m4 778 m4/wcrtomb.m4
504 m4/wctype.m4 779 m4/wctype_h.m4
505 m4/wint_t.m4 780 m4/wint_t.m4
506 m4/write.m4 781 m4/write.m4
507 m4/xalloc.m4 782 m4/xalloc.m4
diff --git a/gl/m4/gnulib-tool.m4 b/gl/m4/gnulib-tool.m4
index 4438d48..69e7733 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 Free Software Foundation, Inc. 2dnl Copyright (C) 2004-2005, 2009-2010 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 4a96af7..1111041 100644
--- a/gl/m4/hostent.m4
+++ b/gl/m4/hostent.m4
@@ -1,5 +1,5 @@
1# hostent.m4 serial 1 1# hostent.m4 serial 1
2dnl Copyright (C) 2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2008, 2009, 2010 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/iconv.m4 b/gl/m4/iconv.m4
index 3cc6268..f46ff14 100644
--- a/gl/m4/iconv.m4
+++ b/gl/m4/iconv.m4
@@ -1,5 +1,5 @@
1# iconv.m4 serial AM7 (gettext-0.18) 1# iconv.m4 serial 9 (gettext-0.18)
2dnl Copyright (C) 2000-2002, 2007-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2007-2010 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.
@@ -58,7 +58,7 @@ AC_DEFUN([AM_ICONV_LINK],
58 ]) 58 ])
59 if test "$am_cv_func_iconv" = yes; then 59 if test "$am_cv_func_iconv" = yes; then
60 AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ 60 AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
61 dnl This tests against bugs in AIX 5.1 and HP-UX 11.11. 61 dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10.
62 am_save_LIBS="$LIBS" 62 am_save_LIBS="$LIBS"
63 if test $am_cv_lib_iconv = yes; then 63 if test $am_cv_lib_iconv = yes; then
64 LIBS="$LIBS $LIBICONV" 64 LIBS="$LIBS $LIBICONV"
@@ -87,6 +87,25 @@ int main ()
87 return 1; 87 return 1;
88 } 88 }
89 } 89 }
90 /* Test against Solaris 10 bug: Failures are not distinguishable from
91 successful returns. */
92 {
93 iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
94 if (cd_ascii_to_88591 != (iconv_t)(-1))
95 {
96 static const char input[] = "\263";
97 char buf[10];
98 const char *inptr = input;
99 size_t inbytesleft = strlen (input);
100 char *outptr = buf;
101 size_t outbytesleft = sizeof (buf);
102 size_t res = iconv (cd_ascii_to_88591,
103 (char **) &inptr, &inbytesleft,
104 &outptr, &outbytesleft);
105 if (res == 0)
106 return 1;
107 }
108 }
90#if 0 /* This bug could be worked around by the caller. */ 109#if 0 /* This bug could be worked around by the caller. */
91 /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ 110 /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
92 { 111 {
@@ -172,8 +191,8 @@ size_t iconv();
172], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"]) 191], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"])
173 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);"]) 192 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);"])
174 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` 193 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
175 AC_MSG_RESULT([${ac_t:- 194 AC_MSG_RESULT([
176 }$am_cv_proto_iconv]) 195 $am_cv_proto_iconv])
177 AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], 196 AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
178 [Define as const if the declaration of iconv() needs const.]) 197 [Define as const if the declaration of iconv() needs const.])
179 fi 198 fi
diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4
index d6101fe..c7e0672 100644
--- a/gl/m4/include_next.m4
+++ b/gl/m4/include_next.m4
@@ -1,5 +1,5 @@
1# include_next.m4 serial 12 1# include_next.m4 serial 14
2dnl Copyright (C) 2006-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2006-2010 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.
@@ -104,10 +104,16 @@ EOF
104# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be 104# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
105# '<foo.h>'; otherwise define it to be 105# '<foo.h>'; otherwise define it to be
106# '"///usr/include/foo.h"', or whatever other absolute file name is suitable. 106# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
107# Also, if #include_next works as first preprocessing directive in a file,
108# define NEXT_AS_FIRST_DIRECTIVE_FOO_H to be '<foo.h>'; otherwise define it to
109# be
110# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
107# That way, a header file with the following line: 111# That way, a header file with the following line:
108# #@INCLUDE_NEXT@ @NEXT_FOO_H@ 112# #@INCLUDE_NEXT@ @NEXT_FOO_H@
113# or
114# #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
109# behaves (after sed substitution) as if it contained 115# behaves (after sed substitution) as if it contained
110# #include_next <foo.h> 116# #include_next <foo.h>
111# even if the compiler does not support include_next. 117# even if the compiler does not support include_next.
112# The three "///" are to pacify Sun C 5.8, which otherwise would say 118# The three "///" are to pacify Sun C 5.8, which otherwise would say
113# "warning: #include of /usr/include/... may be non-portable". 119# "warning: #include of /usr/include/... may be non-portable".
@@ -123,49 +129,59 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS],
123 129
124 m4_foreach_w([gl_HEADER_NAME], [$1], 130 m4_foreach_w([gl_HEADER_NAME], [$1],
125 [AS_VAR_PUSHDEF([gl_next_header], 131 [AS_VAR_PUSHDEF([gl_next_header],
126 [gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME]))) 132 [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
127 if test $gl_cv_have_include_next = yes; then 133 if test $gl_cv_have_include_next = yes; then
128 AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) 134 AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
129 else 135 else
130 AC_CACHE_CHECK( 136 AC_CACHE_CHECK(
131 [absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>], 137 [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
132 m4_quote(m4_defn([gl_next_header])), 138 m4_defn([gl_next_header]),
133 [AS_VAR_PUSHDEF([gl_header_exists], 139 [AS_VAR_PUSHDEF([gl_header_exists],
134 [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME]))) 140 [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
135 if test AS_VAR_GET(gl_header_exists) = yes; then 141 if test AS_VAR_GET(gl_header_exists) = yes; then
136 AC_LANG_CONFTEST( 142 AC_LANG_CONFTEST(
137 [AC_LANG_SOURCE( 143 [AC_LANG_SOURCE(
138 [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] 144 [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
139 )]) 145 )])
140 dnl AIX "xlc -E" and "cc -E" omit #line directives for header files 146 dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
141 dnl that contain only a #include of other header files and no 147 dnl that contain only a #include of other header files and no
142 dnl non-comment tokens of their own. This leads to a failure to 148 dnl non-comment tokens of their own. This leads to a failure to
143 dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h> 149 dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
144 dnl and others. The workaround is to force preservation of comments 150 dnl and others. The workaround is to force preservation of comments
145 dnl through option -C. This ensures all necessary #line directives 151 dnl through option -C. This ensures all necessary #line directives
146 dnl are present. GCC supports option -C as well. 152 dnl are present. GCC supports option -C as well.
147 case "$host_os" in 153 case "$host_os" in
148 aix*) gl_absname_cpp="$ac_cpp -C" ;; 154 aix*) gl_absname_cpp="$ac_cpp -C" ;;
149 *) gl_absname_cpp="$ac_cpp" ;; 155 *) gl_absname_cpp="$ac_cpp" ;;
150 esac 156 esac
151 dnl eval is necessary to expand gl_absname_cpp. 157 dnl eval is necessary to expand gl_absname_cpp.
152 dnl Ultrix and Pyramid sh refuse to redirect output of eval, 158 dnl Ultrix and Pyramid sh refuse to redirect output of eval,
153 dnl so use subshell. 159 dnl so use subshell.
154 AS_VAR_SET([gl_next_header], 160 AS_VAR_SET([gl_next_header],
155 ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | 161 ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
156 sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{ 162 sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{
157 s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1# 163 s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
158 s#^/[^/]#//&# 164 s#^/[^/]#//&#
159 p 165 p
160 q 166 q
161 }'`'"']) 167 }'`'"'])
162 else 168 else
163 AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) 169 AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
164 fi 170 fi
165 AS_VAR_POPDEF([gl_header_exists])]) 171 AS_VAR_POPDEF([gl_header_exists])])
166 fi 172 fi
167 AC_SUBST( 173 AC_SUBST(
168 AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))), 174 AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
169 [AS_VAR_GET([gl_next_header])]) 175 [AS_VAR_GET([gl_next_header])])
176 if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
177 # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
178 gl_next_as_first_directive='<'gl_HEADER_NAME'>'
179 else
180 # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
181 gl_next_as_first_directive=AS_VAR_GET([gl_next_header])
182 fi
183 AC_SUBST(
184 AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])),
185 [$gl_next_as_first_directive])
170 AS_VAR_POPDEF([gl_next_header])]) 186 AS_VAR_POPDEF([gl_next_header])])
171]) 187])
diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4
index 2bbdca1..a6d219c 100644
--- a/gl/m4/inet_ntop.m4
+++ b/gl/m4/inet_ntop.m4
@@ -1,27 +1,28 @@
1# inet_ntop.m4 serial 9 1# inet_ntop.m4 serial 12
2dnl Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2005, 2006, 2008, 2009, 2010 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_INET_NTOP], 7AC_DEFUN([gl_FUNC_INET_NTOP],
8[ 8[
9 dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop. 9 dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop.
10 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 10 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
11 11
12 gl_REPLACE_ARPA_INET_H 12 gl_REPLACE_ARPA_INET_H
13 13
14 dnl The AC_SEARCH_LIBS call is a hack to persuade the Solaris 8 linker to 14 dnl Most platforms that provide inet_ntop define it in libc.
15 dnl find inet_ntop. 15 dnl Solaris 8..10 provide inet_ntop in libnsl instead.
16 dnl
17 dnl It is the responsibility of gl_INET_NTOP's caller to arrange for
18 dnl -lnsl if it is needed. Normally -lnsl is not needed on Solaris 8,
19 dnl since inet_ntop is needed only by getaddrinfo, and getaddrinfo
20 dnl isn't built on Solaris 8.
21 gl_save_LIBS=$LIBS 16 gl_save_LIBS=$LIBS
22 AC_SEARCH_LIBS([inet_ntop], [nsl], [], 17 AC_SEARCH_LIBS([inet_ntop], [nsl], [],
23 [AC_REPLACE_FUNCS([inet_ntop])]) 18 [AC_REPLACE_FUNCS([inet_ntop])])
24 LIBS=$gl_save_LIBS 19 LIBS=$gl_save_LIBS
20 INET_NTOP_LIB=
21 if test "$ac_cv_search_inet_ntop" != "no" &&
22 test "$ac_cv_search_inet_ntop" != "none required"; then
23 INET_NTOP_LIB="$ac_cv_search_inet_ntop"
24 fi
25 AC_SUBST([INET_NTOP_LIB])
25 26
26 gl_PREREQ_INET_NTOP 27 gl_PREREQ_INET_NTOP
27]) 28])
diff --git a/gl/m4/inline.m4 b/gl/m4/inline.m4
index cee5109..4ef768d 100644
--- a/gl/m4/inline.m4
+++ b/gl/m4/inline.m4
@@ -1,5 +1,5 @@
1# inline.m4 serial 4 1# inline.m4 serial 4
2dnl Copyright (C) 2006, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2006, 2009, 2010 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/intdiv0.m4 b/gl/m4/intdiv0.m4
index 29e6e0a..289c4df 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 3 (gettext-0.18)
2dnl Copyright (C) 2002, 2007-2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2007-2010 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/intl.m4 b/gl/m4/intl.m4
index 934408b..5e17fea 100644
--- a/gl/m4/intl.m4
+++ b/gl/m4/intl.m4
@@ -1,5 +1,5 @@
1# intl.m4 serial 8 (gettext-0.17) 1# intl.m4 serial 8 (gettext-0.17)
2dnl Copyright (C) 1995-2007 Free Software Foundation, Inc. 2dnl Copyright (C) 1995-2007, 2009-2010 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/intldir.m4 b/gl/m4/intldir.m4
index 0980e6f..ebae76d 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 Free Software Foundation, Inc. 2dnl Copyright (C) 2006, 2009-2010 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 c24837c..dd91025 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 3 (gettext-0.18)
2dnl Copyright (C) 2004-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2004-2010 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/intmax.m4 b/gl/m4/intmax.m4
index a3785e9..74aaaf5 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 5 (gettext-0.18)
2dnl Copyright (C) 2002-2005, 2008, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2005, 2008-2010 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/intmax_t.m4 b/gl/m4/intmax_t.m4
index 264cb57..975caac 100644
--- a/gl/m4/intmax_t.m4
+++ b/gl/m4/intmax_t.m4
@@ -1,5 +1,6 @@
1# intmax_t.m4 serial 7 1# intmax_t.m4 serial 7
2dnl Copyright (C) 1997-2004, 2006-2007, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2004, 2006-2007, 2009-2010 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.
diff --git a/gl/m4/inttypes-pri.m4 b/gl/m4/inttypes-pri.m4
index 98fec7b..718a4f4 100644
--- a/gl/m4/inttypes-pri.m4
+++ b/gl/m4/inttypes-pri.m4
@@ -1,5 +1,5 @@
1# inttypes-pri.m4 serial 6 (gettext-0.18) 1# inttypes-pri.m4 serial 6 (gettext-0.18)
2dnl Copyright (C) 1997-2002, 2006, 2008, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2002, 2006, 2008-2010 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/inttypes_h.m4 b/gl/m4/inttypes_h.m4
index f4ca160..782d77e 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 9
2dnl Copyright (C) 1997-2004, 2006, 2008, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2004, 2006, 2008-2010 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/langinfo_h.m4 b/gl/m4/langinfo_h.m4
new file mode 100644
index 0000000..11a5698
--- /dev/null
+++ b/gl/m4/langinfo_h.m4
@@ -0,0 +1,77 @@
1# langinfo_h.m4 serial 6
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
7AC_DEFUN([gl_LANGINFO_H],
8[
9 AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
10
11 dnl Persuade glibc-2.0.6 <langinfo.h> to define CODESET.
12 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
13
14 dnl <langinfo.h> is always overridden, because of GNULIB_POSIXCHECK.
15 gl_CHECK_NEXT_HEADERS([langinfo.h])
16
17 dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS.
18 HAVE_LANGINFO_CODESET=0
19 HAVE_LANGINFO_ERA=0
20 AC_CHECK_HEADERS_ONCE([langinfo.h])
21 if test $ac_cv_header_langinfo_h = yes; then
22 HAVE_LANGINFO_H=1
23 dnl Determine what <langinfo.h> defines. CODESET and ERA etc. are missing
24 dnl on OpenBSD 3.8.
25 AC_CACHE_CHECK([whether langinfo.h defines CODESET],
26 [gl_cv_header_langinfo_codeset],
27 [AC_COMPILE_IFELSE(
28 [AC_LANG_PROGRAM([[#include <langinfo.h>
29int a = CODESET;
30]])],
31 [gl_cv_header_langinfo_codeset=yes],
32 [gl_cv_header_langinfo_codeset=no])
33 ])
34 if test $gl_cv_header_langinfo_codeset = yes; then
35 HAVE_LANGINFO_CODESET=1
36 fi
37 AC_CACHE_CHECK([whether langinfo.h defines ERA],
38 [gl_cv_header_langinfo_era],
39 [AC_COMPILE_IFELSE(
40 [AC_LANG_PROGRAM([[#include <langinfo.h>
41int a = ERA;
42]])],
43 [gl_cv_header_langinfo_era=yes],
44 [gl_cv_header_langinfo_era=no])
45 ])
46 if test $gl_cv_header_langinfo_era = yes; then
47 HAVE_LANGINFO_ERA=1
48 fi
49 else
50 HAVE_LANGINFO_H=0
51 fi
52 AC_SUBST([HAVE_LANGINFO_H])
53 AC_SUBST([HAVE_LANGINFO_CODESET])
54 AC_SUBST([HAVE_LANGINFO_ERA])
55
56 dnl Check for declarations of anything we want to poison if the
57 dnl corresponding gnulib module is not in use.
58 gl_WARN_ON_USE_PREPARE([[#include <langinfo.h>
59 ]], [nl_langinfo])
60])
61
62AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR],
63[
64 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
65 AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
66 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
67 dnl Define it also as a C macro, for the benefit of the unit tests.
68 gl_MODULE_INDICATOR_FOR_TESTS([$1])
69])
70
71AC_DEFUN([gl_LANGINFO_H_DEFAULTS],
72[
73 GNULIB_NL_LANGINFO=0; AC_SUBST([GNULIB_NL_LANGINFO])
74 dnl Assume proper GNU behavior unless another module says otherwise.
75 HAVE_NL_LANGINFO=1; AC_SUBST([HAVE_NL_LANGINFO])
76 REPLACE_NL_LANGINFO=0; AC_SUBST([REPLACE_NL_LANGINFO])
77])
diff --git a/gl/m4/lcmessage.m4 b/gl/m4/lcmessage.m4
index fa8e416..1a70543 100644
--- a/gl/m4/lcmessage.m4
+++ b/gl/m4/lcmessage.m4
@@ -1,5 +1,6 @@
1# lcmessage.m4 serial 6 (gettext-0.18) 1# lcmessage.m4 serial 6 (gettext-0.18)
2dnl Copyright (C) 1995-2002, 2004-2005, 2008, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 1995-2002, 2004-2005, 2008-2010 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.
diff --git a/gl/m4/lib-ld.m4 b/gl/m4/lib-ld.m4
index e4863f2..ebb3052 100644
--- a/gl/m4/lib-ld.m4
+++ b/gl/m4/lib-ld.m4
@@ -1,5 +1,5 @@
1# lib-ld.m4 serial 4 (gettext-0.18) 1# lib-ld.m4 serial 4 (gettext-0.18)
2dnl Copyright (C) 1996-2003, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 1996-2003, 2009-2010 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,7 +59,7 @@ if test "$GCC" = yes; then
59 # Canonicalize the path of ld 59 # Canonicalize the path of ld
60 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` 60 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
61 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do 61 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
62 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` 62 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
63 done 63 done
64 test -z "$LD" && LD="$ac_prog" 64 test -z "$LD" && LD="$ac_prog"
65 ;; 65 ;;
@@ -89,9 +89,9 @@ AC_CACHE_VAL([acl_cv_path_LD],
89 # Break only if it was the GNU/non-GNU ld that we prefer. 89 # 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 90 case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
91 *GNU* | *'with BFD'*) 91 *GNU* | *'with BFD'*)
92 test "$with_gnu_ld" != no && break ;; 92 test "$with_gnu_ld" != no && break ;;
93 *) 93 *)
94 test "$with_gnu_ld" != yes && break ;; 94 test "$with_gnu_ld" != yes && break ;;
95 esac 95 esac
96 fi 96 fi
97 done 97 done
diff --git a/gl/m4/lib-link.m4 b/gl/m4/lib-link.m4
index 2144203..90e1ac9 100644
--- a/gl/m4/lib-link.m4
+++ b/gl/m4/lib-link.m4
@@ -1,5 +1,5 @@
1# lib-link.m4 serial 19 (gettext-0.18) 1# lib-link.m4 serial 20 (gettext-0.18)
2dnl Copyright (C) 2001-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2010 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.
@@ -82,7 +82,7 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
82 ]) 82 ])
83 if test "$ac_cv_lib[]Name" = yes; then 83 if test "$ac_cv_lib[]Name" = yes; then
84 HAVE_LIB[]NAME=yes 84 HAVE_LIB[]NAME=yes
85 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib[]$1 library.]) 85 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
86 AC_MSG_CHECKING([how to link with lib[]$1]) 86 AC_MSG_CHECKING([how to link with lib[]$1])
87 AC_MSG_RESULT([$LIB[]NAME]) 87 AC_MSG_RESULT([$LIB[]NAME])
88 else 88 else
@@ -210,6 +210,9 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
210 LTLIB[]NAME= 210 LTLIB[]NAME=
211 INC[]NAME= 211 INC[]NAME=
212 LIB[]NAME[]_PREFIX= 212 LIB[]NAME[]_PREFIX=
213 dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
214 dnl computed. So it has to be reset here.
215 HAVE_LIB[]NAME=
213 rpathdirs= 216 rpathdirs=
214 ltrpathdirs= 217 ltrpathdirs=
215 names_already_handled= 218 names_already_handled=
diff --git a/gl/m4/lib-prefix.m4 b/gl/m4/lib-prefix.m4
index 4b7ee33..1601cea 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-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2005, 2008-2010 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 e960104..ee2e801 100644
--- a/gl/m4/localcharset.m4
+++ b/gl/m4/localcharset.m4
@@ -1,5 +1,5 @@
1# localcharset.m4 serial 6 1# localcharset.m4 serial 7
2dnl Copyright (C) 2002, 2004, 2006, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2004, 2006, 2009, 2010 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,7 @@ AC_DEFUN([gl_LOCALCHARSET],
8[ 8[
9 dnl Prerequisites of lib/localcharset.c. 9 dnl Prerequisites of lib/localcharset.c.
10 AC_REQUIRE([AM_LANGINFO_CODESET]) 10 AC_REQUIRE([AM_LANGINFO_CODESET])
11 AC_REQUIRE([gl_FCNTL_O_FLAGS])
11 AC_CHECK_DECLS_ONCE([getc_unlocked]) 12 AC_CHECK_DECLS_ONCE([getc_unlocked])
12 13
13 dnl Prerequisites of the lib/Makefile.am snippet. 14 dnl Prerequisites of the lib/Makefile.am snippet.
diff --git a/gl/m4/locale-fr.m4 b/gl/m4/locale-fr.m4
index 653a5bc..001f539 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 11
2dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2005-2010 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-ja.m4 b/gl/m4/locale-ja.m4
index 9360576..0eedaf1 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 7
2dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2005-2010 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-zh.m4 b/gl/m4/locale-zh.m4
index 36a5f1d..777fd14 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 6
2dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2005-2010 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_h.m4 b/gl/m4/locale_h.m4
new file mode 100644
index 0000000..18a119b
--- /dev/null
+++ b/gl/m4/locale_h.m4
@@ -0,0 +1,92 @@
1# locale_h.m4 serial 10
2dnl Copyright (C) 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_LOCALE_H],
8[
9 dnl Use AC_REQUIRE here, so that the default behavior below is expanded
10 dnl once only, before all statements that occur in other macros.
11 AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
12
13 dnl Persuade glibc <locale.h> to define locale_t.
14 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
15
16 dnl If <stddef.h> is replaced, then <locale.h> must also be replaced.
17 AC_REQUIRE([gl_STDDEF_H])
18
19 AC_CACHE_CHECK([whether locale.h conforms to POSIX:2001],
20 [gl_cv_header_locale_h_posix2001],
21 [AC_TRY_COMPILE([#include <locale.h>
22int x = LC_MESSAGES;], [],
23 [gl_cv_header_locale_h_posix2001=yes],
24 [gl_cv_header_locale_h_posix2001=no])])
25
26 dnl Check for <xlocale.h>.
27 AC_CHECK_HEADERS_ONCE([xlocale.h])
28 if test $ac_cv_header_xlocale_h = yes; then
29 HAVE_XLOCALE_H=1
30 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
32 dnl itself, we assume that <xlocale.h> will do so.
33 AC_CACHE_CHECK([whether locale.h defines locale_t],
34 [gl_cv_header_locale_has_locale_t],
35 [AC_TRY_COMPILE([#include <locale.h>
36locale_t x;], [],
37 [gl_cv_header_locale_has_locale_t=yes],
38 [gl_cv_header_locale_has_locale_t=no])
39 ])
40 if test $gl_cv_header_locale_has_locale_t = yes; then
41 gl_cv_header_locale_h_needs_xlocale_h=no
42 else
43 gl_cv_header_locale_h_needs_xlocale_h=yes
44 fi
45 else
46 HAVE_XLOCALE_H=0
47 gl_cv_header_locale_h_needs_xlocale_h=no
48 fi
49 AC_SUBST([HAVE_XLOCALE_H])
50
51 dnl <locale.h> is always overridden, because of GNULIB_POSIXCHECK.
52 gl_CHECK_NEXT_HEADERS([locale.h])
53
54 if test -n "$STDDEF_H" \
55 || test $gl_cv_header_locale_h_posix2001 = no \
56 || test $gl_cv_header_locale_h_needs_xlocale_h = yes; then
57 gl_REPLACE_LOCALE_H
58 fi
59
60 dnl Check for declarations of anything we want to poison if the
61 dnl corresponding gnulib module is not in use.
62 gl_WARN_ON_USE_PREPARE([[#include <locale.h>
63/* Some systems provide declarations in a non-standard header. */
64#if HAVE_XLOCALE_H
65# include <xlocale.h>
66#endif
67 ]], [duplocale])
68])
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])
76
77AC_DEFUN([gl_LOCALE_MODULE_INDICATOR],
78[
79 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
80 AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
81 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
82 dnl Define it also as a C macro, for the benefit of the unit tests.
83 gl_MODULE_INDICATOR_FOR_TESTS([$1])
84])
85
86AC_DEFUN([gl_LOCALE_H_DEFAULTS],
87[
88 GNULIB_DUPLOCALE=0; AC_SUBST([GNULIB_DUPLOCALE])
89 dnl Assume proper GNU behavior unless another module says otherwise.
90 HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE])
91 REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE])
92])
diff --git a/gl/m4/lock.m4 b/gl/m4/lock.m4
index b416e31..9da8465 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 10 (gettext-0.18)
2dnl Copyright (C) 2005-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2005-2010 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/longlong.m4 b/gl/m4/longlong.m4
index eedc8d5..cca3c1a 100644
--- a/gl/m4/longlong.m4
+++ b/gl/m4/longlong.m4
@@ -1,5 +1,5 @@
1# longlong.m4 serial 14 1# longlong.m4 serial 14
2dnl Copyright (C) 1999-2007, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 1999-2007, 2009-2010 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,30 +20,30 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
20 [AC_LINK_IFELSE( 20 [AC_LINK_IFELSE(
21 [_AC_TYPE_LONG_LONG_SNIPPET], 21 [_AC_TYPE_LONG_LONG_SNIPPET],
22 [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. 22 [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
23 dnl If cross compiling, assume the bug isn't important, since 23 dnl If cross compiling, assume the bug isn't important, since
24 dnl nobody cross compiles for this platform as far as we know. 24 dnl nobody cross compiles for this platform as far as we know.
25 AC_RUN_IFELSE( 25 AC_RUN_IFELSE(
26 [AC_LANG_PROGRAM( 26 [AC_LANG_PROGRAM(
27 [[@%:@include <limits.h> 27 [[@%:@include <limits.h>
28 @%:@ifndef LLONG_MAX 28 @%:@ifndef LLONG_MAX
29 @%:@ define HALF \ 29 @%:@ define HALF \
30 (1LL << (sizeof (long long int) * CHAR_BIT - 2)) 30 (1LL << (sizeof (long long int) * CHAR_BIT - 2))
31 @%:@ define LLONG_MAX (HALF - 1 + HALF) 31 @%:@ define LLONG_MAX (HALF - 1 + HALF)
32 @%:@endif]], 32 @%:@endif]],
33 [[long long int n = 1; 33 [[long long int n = 1;
34 int i; 34 int i;
35 for (i = 0; ; i++) 35 for (i = 0; ; i++)
36 { 36 {
37 long long int m = n << i; 37 long long int m = n << i;
38 if (m >> i != n) 38 if (m >> i != n)
39 return 1; 39 return 1;
40 if (LLONG_MAX / 2 < m) 40 if (LLONG_MAX / 2 < m)
41 break; 41 break;
42 } 42 }
43 return 0;]])], 43 return 0;]])],
44 [ac_cv_type_long_long_int=yes], 44 [ac_cv_type_long_long_int=yes],
45 [ac_cv_type_long_long_int=no], 45 [ac_cv_type_long_long_int=no],
46 [ac_cv_type_long_long_int=yes])], 46 [ac_cv_type_long_long_int=yes])],
47 [ac_cv_type_long_long_int=no])]) 47 [ac_cv_type_long_long_int=no])])
48 if test $ac_cv_type_long_long_int = yes; then 48 if test $ac_cv_type_long_long_int = yes; then
49 AC_DEFINE([HAVE_LONG_LONG_INT], [1], 49 AC_DEFINE([HAVE_LONG_LONG_INT], [1],
@@ -83,24 +83,24 @@ AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
83[ 83[
84 AC_LANG_PROGRAM( 84 AC_LANG_PROGRAM(
85 [[/* For now, do not test the preprocessor; as of 2007 there are too many 85 [[/* For now, do not test the preprocessor; as of 2007 there are too many
86 implementations with broken preprocessors. Perhaps this can 86 implementations with broken preprocessors. Perhaps this can
87 be revisited in 2012. In the meantime, code should not expect 87 be revisited in 2012. In the meantime, code should not expect
88 #if to work with literals wider than 32 bits. */ 88 #if to work with literals wider than 32 bits. */
89 /* Test literals. */ 89 /* Test literals. */
90 long long int ll = 9223372036854775807ll; 90 long long int ll = 9223372036854775807ll;
91 long long int nll = -9223372036854775807LL; 91 long long int nll = -9223372036854775807LL;
92 unsigned long long int ull = 18446744073709551615ULL; 92 unsigned long long int ull = 18446744073709551615ULL;
93 /* Test constant expressions. */ 93 /* Test constant expressions. */
94 typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) 94 typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
95 ? 1 : -1)]; 95 ? 1 : -1)];
96 typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 96 typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
97 ? 1 : -1)]; 97 ? 1 : -1)];
98 int i = 63;]], 98 int i = 63;]],
99 [[/* Test availability of runtime routines for shift and division. */ 99 [[/* Test availability of runtime routines for shift and division. */
100 long long int llmax = 9223372036854775807ll; 100 long long int llmax = 9223372036854775807ll;
101 unsigned long long int ullmax = 18446744073709551615ull; 101 unsigned long long int ullmax = 18446744073709551615ull;
102 return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) 102 return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
103 | (llmax / ll) | (llmax % ll) 103 | (llmax / ll) | (llmax % ll)
104 | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) 104 | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
105 | (ullmax / ull) | (ullmax % ull));]]) 105 | (ullmax / ull) | (ullmax % ull));]])
106]) 106])
diff --git a/gl/m4/ls-mntd-fs.m4 b/gl/m4/ls-mntd-fs.m4
index 32ccb98..40b9336 100644
--- a/gl/m4/ls-mntd-fs.m4
+++ b/gl/m4/ls-mntd-fs.m4
@@ -1,7 +1,7 @@
1# serial 27 1# serial 28
2# How to list mounted file systems. 2# How to list mounted file systems.
3 3
4# Copyright (C) 1998-2004, 2006, 2009 Free Software Foundation, Inc. 4# Copyright (C) 1998-2004, 2006, 2009-2010 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,
@@ -84,7 +84,7 @@ if test -z "$ac_list_mounted_fs"; then
84yes 84yes
85#endif 85#endif
86 ], [test $ac_cv_func_listmntent = yes \ 86 ], [test $ac_cv_func_listmntent = yes \
87 && fu_cv_sys_mounted_cray_listmntent=yes] 87 && fu_cv_sys_mounted_cray_listmntent=yes]
88 ) 88 )
89 ] 89 ]
90 ) 90 )
@@ -101,14 +101,14 @@ if test -z "$ac_list_mounted_fs"; then
101 # AIX. 101 # AIX.
102 AC_MSG_CHECKING([for mntctl function and struct vmount]) 102 AC_MSG_CHECKING([for mntctl function and struct vmount])
103 AC_CACHE_VAL([fu_cv_sys_mounted_vmount], 103 AC_CACHE_VAL([fu_cv_sys_mounted_vmount],
104 [AC_TRY_CPP([#include <fshelp.h>], 104 [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <fshelp.h>]])],
105 fu_cv_sys_mounted_vmount=yes, 105 [fu_cv_sys_mounted_vmount=yes],
106 fu_cv_sys_mounted_vmount=no)]) 106 [fu_cv_sys_mounted_vmount=no])])
107 AC_MSG_RESULT([$fu_cv_sys_mounted_vmount]) 107 AC_MSG_RESULT([$fu_cv_sys_mounted_vmount])
108 if test $fu_cv_sys_mounted_vmount = yes; then 108 if test $fu_cv_sys_mounted_vmount = yes; then
109 ac_list_mounted_fs=found 109 ac_list_mounted_fs=found
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
@@ -123,27 +123,27 @@ if test $ac_cv_func_getmntent = yes; then
123 # 4.3BSD, SunOS, HP-UX, Dynix, Irix 123 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
124 AC_MSG_CHECKING([for one-argument getmntent function]) 124 AC_MSG_CHECKING([for one-argument getmntent function])
125 AC_CACHE_VAL([fu_cv_sys_mounted_getmntent1], 125 AC_CACHE_VAL([fu_cv_sys_mounted_getmntent1],
126 [AC_TRY_COMPILE([ 126 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
127/* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */ 127/* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */
128#include <stdio.h> 128#include <stdio.h>
129 129
130#include <mntent.h> 130#include <mntent.h>
131#if !defined MOUNTED 131#if !defined MOUNTED
132# if defined _PATH_MOUNTED /* GNU libc */ 132# if defined _PATH_MOUNTED /* GNU libc */
133# define MOUNTED _PATH_MOUNTED 133# define MOUNTED _PATH_MOUNTED
134# endif 134# endif
135# if defined MNT_MNTTAB /* HP-UX. */ 135# if defined MNT_MNTTAB /* HP-UX. */
136# define MOUNTED MNT_MNTTAB 136# define MOUNTED MNT_MNTTAB
137# endif 137# endif
138# if defined MNTTABNAME /* Dynix. */ 138# if defined MNTTABNAME /* Dynix. */
139# define MOUNTED MNTTABNAME 139# define MOUNTED MNTTABNAME
140# endif 140# endif
141#endif 141#endif
142], 142]],
143 [ struct mntent *mnt = 0; char *table = MOUNTED; 143 [[ struct mntent *mnt = 0; char *table = MOUNTED;
144 if (sizeof mnt && sizeof table) return 0;], 144 if (sizeof mnt && sizeof table) return 0;]])],
145 fu_cv_sys_mounted_getmntent1=yes, 145 [fu_cv_sys_mounted_getmntent1=yes],
146 fu_cv_sys_mounted_getmntent1=no)]) 146 [fu_cv_sys_mounted_getmntent1=no])])
147 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1]) 147 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1])
148 if test $fu_cv_sys_mounted_getmntent1 = yes; then 148 if test $fu_cv_sys_mounted_getmntent1 = yes; then
149 ac_list_mounted_fs=found 149 ac_list_mounted_fs=found
@@ -179,25 +179,25 @@ if test -z "$ac_list_mounted_fs"; then
179 179
180 AC_MSG_CHECKING([for getfsstat function]) 180 AC_MSG_CHECKING([for getfsstat function])
181 AC_CACHE_VAL([fu_cv_sys_mounted_getfsstat], 181 AC_CACHE_VAL([fu_cv_sys_mounted_getfsstat],
182 [AC_TRY_LINK([ 182 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
183#include <sys/types.h> 183#include <sys/types.h>
184#if HAVE_STRUCT_FSSTAT_F_FSTYPENAME 184#if HAVE_STRUCT_FSSTAT_F_FSTYPENAME
185# define FS_TYPE(Ent) ((Ent).f_fstypename) 185# define FS_TYPE(Ent) ((Ent).f_fstypename)
186#else 186#else
187# define FS_TYPE(Ent) mnt_names[(Ent).f_type] 187# define FS_TYPE(Ent) mnt_names[(Ent).f_type]
188#endif 188#endif
189]$getfsstat_includes 189$getfsstat_includes]]
190, 190,
191 [struct statfs *stats; 191 [[struct statfs *stats;
192 int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); 192 int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT);
193 char *t = FS_TYPE (*stats); ], 193 char *t = FS_TYPE (*stats); ]])],
194 fu_cv_sys_mounted_getfsstat=yes, 194 [fu_cv_sys_mounted_getfsstat=yes],
195 fu_cv_sys_mounted_getfsstat=no)]) 195 [fu_cv_sys_mounted_getfsstat=no])])
196 AC_MSG_RESULT([$fu_cv_sys_mounted_getfsstat]) 196 AC_MSG_RESULT([$fu_cv_sys_mounted_getfsstat])
197 if test $fu_cv_sys_mounted_getfsstat = yes; then 197 if test $fu_cv_sys_mounted_getfsstat = yes; then
198 ac_list_mounted_fs=found 198 ac_list_mounted_fs=found
199 AC_DEFINE([MOUNTED_GETFSSTAT], [1], 199 AC_DEFINE([MOUNTED_GETFSSTAT], [1],
200 [Define if there is a function named getfsstat for reading the 200 [Define if there is a function named getfsstat for reading the
201 list of mounted file systems. (DEC Alpha running OSF/1)]) 201 list of mounted file systems. (DEC Alpha running OSF/1)])
202 fi 202 fi
203fi 203fi
@@ -206,12 +206,12 @@ if test -z "$ac_list_mounted_fs"; then
206 # SVR3 206 # SVR3
207 AC_MSG_CHECKING([for FIXME existence of three headers]) 207 AC_MSG_CHECKING([for FIXME existence of three headers])
208 AC_CACHE_VAL([fu_cv_sys_mounted_fread_fstyp], 208 AC_CACHE_VAL([fu_cv_sys_mounted_fread_fstyp],
209 [AC_TRY_CPP([ 209 [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
210#include <sys/statfs.h> 210#include <sys/statfs.h>
211#include <sys/fstyp.h> 211#include <sys/fstyp.h>
212#include <mnttab.h>], 212#include <mnttab.h>]])],
213 fu_cv_sys_mounted_fread_fstyp=yes, 213 [fu_cv_sys_mounted_fread_fstyp=yes],
214 fu_cv_sys_mounted_fread_fstyp=no)]) 214 [fu_cv_sys_mounted_fread_fstyp=no])])
215 AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp]) 215 AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp])
216 if test $fu_cv_sys_mounted_fread_fstyp = yes; then 216 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
217 ac_list_mounted_fs=found 217 ac_list_mounted_fs=found
@@ -228,15 +228,15 @@ if test -z "$ac_list_mounted_fs"; then
228 AC_CACHE_VAL([fu_cv_sys_mounted_getmntinfo], 228 AC_CACHE_VAL([fu_cv_sys_mounted_getmntinfo],
229 [ 229 [
230 test "$ac_cv_func_getmntinfo" = yes \ 230 test "$ac_cv_func_getmntinfo" = yes \
231 && fu_cv_sys_mounted_getmntinfo=yes \ 231 && fu_cv_sys_mounted_getmntinfo=yes \
232 || fu_cv_sys_mounted_getmntinfo=no 232 || fu_cv_sys_mounted_getmntinfo=no
233 ]) 233 ])
234 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo]) 234 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo])
235 if test $fu_cv_sys_mounted_getmntinfo = yes; then 235 if test $fu_cv_sys_mounted_getmntinfo = yes; then
236 AC_MSG_CHECKING([whether getmntinfo returns statvfs structures]) 236 AC_MSG_CHECKING([whether getmntinfo returns statvfs structures])
237 AC_CACHE_VAL([fu_cv_sys_mounted_getmntinfo2], 237 AC_CACHE_VAL([fu_cv_sys_mounted_getmntinfo2],
238 [ 238 [
239 AC_TRY_COMPILE([ 239 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
240#if HAVE_SYS_PARAM_H 240#if HAVE_SYS_PARAM_H
241# include <sys/param.h> 241# include <sys/param.h>
242#endif 242#endif
@@ -248,7 +248,7 @@ if test -z "$ac_list_mounted_fs"; then
248# include <sys/statvfs.h> 248# include <sys/statvfs.h>
249#endif 249#endif
250extern int getmntinfo (struct statfs **, int); 250extern int getmntinfo (struct statfs **, int);
251 ], [], 251 ]], [])],
252 [fu_cv_sys_mounted_getmntinfo2=no], 252 [fu_cv_sys_mounted_getmntinfo2=no],
253 [fu_cv_sys_mounted_getmntinfo2=yes]) 253 [fu_cv_sys_mounted_getmntinfo2=yes])
254 ]) 254 ])
@@ -256,13 +256,13 @@ extern int getmntinfo (struct statfs **, int);
256 if test $fu_cv_sys_mounted_getmntinfo2 = no; then 256 if test $fu_cv_sys_mounted_getmntinfo2 = no; then
257 ac_list_mounted_fs=found 257 ac_list_mounted_fs=found
258 AC_DEFINE([MOUNTED_GETMNTINFO], [1], 258 AC_DEFINE([MOUNTED_GETMNTINFO], [1],
259 [Define if there is a function named getmntinfo for reading the 259 [Define if there is a function named getmntinfo for reading the
260 list of mounted file systems and it returns an array of 260 list of mounted file systems and it returns an array of
261 'struct statfs'. (4.4BSD, Darwin)]) 261 'struct statfs'. (4.4BSD, Darwin)])
262 else 262 else
263 ac_list_mounted_fs=found 263 ac_list_mounted_fs=found
264 AC_DEFINE([MOUNTED_GETMNTINFO2], [1], 264 AC_DEFINE([MOUNTED_GETMNTINFO2], [1],
265 [Define if there is a function named getmntinfo for reading the 265 [Define if there is a function named getmntinfo for reading the
266 list of mounted file systems and it returns an array of 266 list of mounted file systems and it returns an array of
267 'struct statvfs'. (NetBSD 3.0)]) 267 'struct statvfs'. (NetBSD 3.0)])
268 fi 268 fi
@@ -273,11 +273,11 @@ if test -z "$ac_list_mounted_fs"; then
273 # Ultrix 273 # Ultrix
274 AC_MSG_CHECKING([for getmnt function]) 274 AC_MSG_CHECKING([for getmnt function])
275 AC_CACHE_VAL([fu_cv_sys_mounted_getmnt], 275 AC_CACHE_VAL([fu_cv_sys_mounted_getmnt],
276 [AC_TRY_CPP([ 276 [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
277#include <sys/fs_types.h> 277#include <sys/fs_types.h>
278#include <sys/mount.h>], 278#include <sys/mount.h>]])],
279 fu_cv_sys_mounted_getmnt=yes, 279 [fu_cv_sys_mounted_getmnt=yes],
280 fu_cv_sys_mounted_getmnt=no)]) 280 [fu_cv_sys_mounted_getmnt=no])])
281 AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt]) 281 AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt])
282 if test $fu_cv_sys_mounted_getmnt = yes; then 282 if test $fu_cv_sys_mounted_getmnt = yes; then
283 ac_list_mounted_fs=found 283 ac_list_mounted_fs=found
@@ -294,7 +294,7 @@ if test -z "$ac_list_mounted_fs"; then
294 AC_MSG_CHECKING([for BEOS mounted file system support functions]) 294 AC_MSG_CHECKING([for BEOS mounted file system support functions])
295 if test $ac_cv_header_fs_info_h = yes \ 295 if test $ac_cv_header_fs_info_h = yes \
296 && test $ac_cv_func_next_dev = yes \ 296 && test $ac_cv_func_next_dev = yes \
297 && test $ac_cv_func_fs_stat_dev = yes; then 297 && test $ac_cv_func_fs_stat_dev = yes; then
298 fu_result=yes 298 fu_result=yes
299 else 299 else
300 fu_result=no 300 fu_result=no
@@ -312,14 +312,14 @@ if test -z "$ac_list_mounted_fs"; then
312 # SVR2 312 # SVR2
313 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab]) 313 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
314 AC_CACHE_VAL([fu_cv_sys_mounted_fread], 314 AC_CACHE_VAL([fu_cv_sys_mounted_fread],
315 [AC_TRY_CPP([#include <mnttab.h>], 315 [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <mnttab.h>]])],
316 fu_cv_sys_mounted_fread=yes, 316 [fu_cv_sys_mounted_fread=yes],
317 fu_cv_sys_mounted_fread=no)]) 317 [fu_cv_sys_mounted_fread=no])])
318 AC_MSG_RESULT([$fu_cv_sys_mounted_fread]) 318 AC_MSG_RESULT([$fu_cv_sys_mounted_fread])
319 if test $fu_cv_sys_mounted_fread = yes; then 319 if test $fu_cv_sys_mounted_fread = yes; then
320 ac_list_mounted_fs=found 320 ac_list_mounted_fs=found
321 AC_DEFINE([MOUNTED_FREAD], [1], 321 AC_DEFINE([MOUNTED_FREAD], [1],
322 [Define if there is no specific function for reading the list of 322 [Define if there is no specific function for reading the list of
323 mounted file systems. fread will be used to read /etc/mnttab. 323 mounted file systems. fread will be used to read /etc/mnttab.
324 (SVR2) ]) 324 (SVR2) ])
325 fi 325 fi
diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4
index 8070171..910ac92 100644
--- a/gl/m4/malloc.m4
+++ b/gl/m4/malloc.m4
@@ -1,5 +1,5 @@
1# malloc.m4 serial 9 1# malloc.m4 serial 9
2dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2007, 2009, 2010 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/math_h.m4 b/gl/m4/math_h.m4
index d941bc3..2d89ca3 100644
--- a/gl/m4/math_h.m4
+++ b/gl/m4/math_h.m4
@@ -1,5 +1,5 @@
1# math_h.m4 serial 14 1# math_h.m4 serial 21
2dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2010 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,8 @@ 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 AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works], 13 AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works],
12 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]], 14 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]],
13 [[/* Solaris 10 has a broken definition of NAN. Other platforms 15 [[/* Solaris 10 has a broken definition of NAN. Other platforms
@@ -15,9 +17,9 @@ AC_DEFUN([gl_MATH_H],
15 test only needs to fail when NAN is provided but wrong. */ 17 test only needs to fail when NAN is provided but wrong. */
16 float f = 1.0f; 18 float f = 1.0f;
17#ifdef NAN 19#ifdef NAN
18 f = NAN; 20 f = NAN;
19#endif 21#endif
20 return f == 0;]])], 22 return f == 0;]])],
21 [gl_cv_header_math_nan_works=yes], 23 [gl_cv_header_math_nan_works=yes],
22 [gl_cv_header_math_nan_works=no])]) 24 [gl_cv_header_math_nan_works=no])])
23 if test $gl_cv_header_math_nan_works = no; then 25 if test $gl_cv_header_math_nan_works = no; then
@@ -26,26 +28,39 @@ AC_DEFUN([gl_MATH_H],
26 AC_CACHE_CHECK([whether HUGE_VAL works], [gl_cv_header_math_huge_val_works], 28 AC_CACHE_CHECK([whether HUGE_VAL works], [gl_cv_header_math_huge_val_works],
27 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]], 29 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]],
28 [[/* Solaris 10 has a broken definition of HUGE_VAL. */ 30 [[/* Solaris 10 has a broken definition of HUGE_VAL. */
29 double d = HUGE_VAL; 31 double d = HUGE_VAL;
30 return d == 0;]])], 32 return d == 0;]])],
31 [gl_cv_header_math_huge_val_works=yes], 33 [gl_cv_header_math_huge_val_works=yes],
32 [gl_cv_header_math_huge_val_works=no])]) 34 [gl_cv_header_math_huge_val_works=no])])
33 if test $gl_cv_header_math_huge_val_works = no; then 35 if test $gl_cv_header_math_huge_val_works = no; then
34 REPLACE_HUGE_VAL=1 36 REPLACE_HUGE_VAL=1
35 fi 37 fi
38
39 dnl Check for declarations of anything we want to poison if the
40 dnl corresponding gnulib module is not in use.
41 gl_WARN_ON_USE_PREPARE([[#include <math.h>
42 ]], [acosl asinl atanl ceilf ceill cosl expl floorf floorl frexpl
43 ldexpl logb logl round roundf roundl sinl sqrtl tanl trunc truncf truncl])
36]) 44])
37 45
38AC_DEFUN([gl_MATH_MODULE_INDICATOR], 46AC_DEFUN([gl_MATH_MODULE_INDICATOR],
39[ 47[
40 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 48 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
41 AC_REQUIRE([gl_MATH_H_DEFAULTS]) 49 AC_REQUIRE([gl_MATH_H_DEFAULTS])
42 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 50 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
51 dnl Define it also as a C macro, for the benefit of the unit tests.
52 gl_MODULE_INDICATOR_FOR_TESTS([$1])
43]) 53])
44 54
45AC_DEFUN([gl_MATH_H_DEFAULTS], 55AC_DEFUN([gl_MATH_H_DEFAULTS],
46[ 56[
57 GNULIB_ACOSL=0; AC_SUBST([GNULIB_ACOSL])
58 GNULIB_ASINL=0; AC_SUBST([GNULIB_ASINL])
59 GNULIB_ATANL=0; AC_SUBST([GNULIB_ATANL])
47 GNULIB_CEILF=0; AC_SUBST([GNULIB_CEILF]) 60 GNULIB_CEILF=0; AC_SUBST([GNULIB_CEILF])
48 GNULIB_CEILL=0; AC_SUBST([GNULIB_CEILL]) 61 GNULIB_CEILL=0; AC_SUBST([GNULIB_CEILL])
62 GNULIB_COSL=0; AC_SUBST([GNULIB_COSL])
63 GNULIB_EXPL=0; AC_SUBST([GNULIB_EXPL])
49 GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF]) 64 GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF])
50 GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL]) 65 GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL])
51 GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP]) 66 GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP])
@@ -57,31 +72,53 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
57 GNULIB_ISNAND=0; AC_SUBST([GNULIB_ISNAND]) 72 GNULIB_ISNAND=0; AC_SUBST([GNULIB_ISNAND])
58 GNULIB_ISNANL=0; AC_SUBST([GNULIB_ISNANL]) 73 GNULIB_ISNANL=0; AC_SUBST([GNULIB_ISNANL])
59 GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL]) 74 GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL])
60 GNULIB_MATHL=0; AC_SUBST([GNULIB_MATHL]) 75 GNULIB_LOGB=0; AC_SUBST([GNULIB_LOGB])
76 GNULIB_LOGL=0; AC_SUBST([GNULIB_LOGL])
61 GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND]) 77 GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND])
62 GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF]) 78 GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF])
63 GNULIB_ROUNDL=0; AC_SUBST([GNULIB_ROUNDL]) 79 GNULIB_ROUNDL=0; AC_SUBST([GNULIB_ROUNDL])
64 GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT]) 80 GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT])
81 GNULIB_SINL=0; AC_SUBST([GNULIB_SINL])
82 GNULIB_SQRTL=0; AC_SUBST([GNULIB_SQRTL])
83 GNULIB_TANL=0; AC_SUBST([GNULIB_TANL])
65 GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC]) 84 GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC])
66 GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF]) 85 GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF])
67 GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL]) 86 GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL])
68 dnl Assume proper GNU behavior unless another module says otherwise. 87 dnl Assume proper GNU behavior unless another module says otherwise.
88 HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL])
89 HAVE_ASINL=1; AC_SUBST([HAVE_ASINL])
90 HAVE_ATANL=1; AC_SUBST([HAVE_ATANL])
91 HAVE_COSL=1; AC_SUBST([HAVE_COSL])
92 HAVE_EXPL=1; AC_SUBST([HAVE_EXPL])
69 HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF]) 93 HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF])
70 HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND]) 94 HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND])
71 HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL]) 95 HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL])
96 HAVE_LOGL=1; AC_SUBST([HAVE_LOGL])
97 HAVE_SINL=1; AC_SUBST([HAVE_SINL])
98 HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL])
99 HAVE_TANL=1; AC_SUBST([HAVE_TANL])
72 HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) 100 HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL])
73 HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) 101 HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL])
74 HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) 102 HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL])
103 HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF])
104 HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL])
75 HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) 105 HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL])
76 HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) 106 HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL])
107 HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF])
108 HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL])
77 HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) 109 HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL])
78 HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) 110 HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL])
111 HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB])
79 HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) 112 HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL])
113 HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND])
114 HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF])
115 HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL])
80 HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) 116 HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL])
81 HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) 117 HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL])
82 HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) 118 HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL])
83 HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC]) 119 HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC])
84 HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF]) 120 HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF])
121 HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL])
85 REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) 122 REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF])
86 REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) 123 REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL])
87 REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF]) 124 REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF])
diff --git a/gl/m4/mbrtowc.m4 b/gl/m4/mbrtowc.m4
index 11d7d23..606de5c 100644
--- a/gl/m4/mbrtowc.m4
+++ b/gl/m4/mbrtowc.m4
@@ -1,5 +1,6 @@
1# mbrtowc.m4 serial 15 1# mbrtowc.m4 serial 17
2dnl Copyright (C) 2001-2002, 2004-2005, 2008, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2002, 2004-2005, 2008-2010 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.
@@ -10,38 +11,39 @@ AC_DEFUN([gl_FUNC_MBRTOWC],
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
13 if test $REPLACE_MBSTATE_T = 1; then 14
14 REPLACE_MBRTOWC=1
15 fi
16 AC_CHECK_FUNCS_ONCE([mbrtowc]) 15 AC_CHECK_FUNCS_ONCE([mbrtowc])
17 if test $ac_cv_func_mbrtowc = no; then 16 if test $ac_cv_func_mbrtowc = no; then
18 HAVE_MBRTOWC=0 17 HAVE_MBRTOWC=0
19 fi 18 else
20 if test $HAVE_MBRTOWC != 0 && test $REPLACE_MBRTOWC != 1; then 19 if test $REPLACE_MBSTATE_T = 1; then
21 gl_MBRTOWC_NULL_ARG 20 REPLACE_MBRTOWC=1
22 gl_MBRTOWC_RETVAL 21 else
23 gl_MBRTOWC_NUL_RETVAL 22 gl_MBRTOWC_NULL_ARG
24 case "$gl_cv_func_mbrtowc_null_arg" in 23 gl_MBRTOWC_RETVAL
25 *yes) ;; 24 gl_MBRTOWC_NUL_RETVAL
26 *) AC_DEFINE([MBRTOWC_NULL_ARG_BUG], [1], 25 case "$gl_cv_func_mbrtowc_null_arg" in
27 [Define if the mbrtowc function has the NULL string argument bug.]) 26 *yes) ;;
28 REPLACE_MBRTOWC=1 27 *) AC_DEFINE([MBRTOWC_NULL_ARG_BUG], [1],
29 ;; 28 [Define if the mbrtowc function has the NULL string argument bug.])
30 esac 29 REPLACE_MBRTOWC=1
31 case "$gl_cv_func_mbrtowc_retval" in 30 ;;
32 *yes) ;; 31 esac
33 *) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1], 32 case "$gl_cv_func_mbrtowc_retval" in
34 [Define if the mbrtowc function returns a wrong return value.]) 33 *yes) ;;
35 REPLACE_MBRTOWC=1 34 *) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1],
36 ;; 35 [Define if the mbrtowc function returns a wrong return value.])
37 esac 36 REPLACE_MBRTOWC=1
38 case "$gl_cv_func_mbrtowc_nul_retval" in 37 ;;
39 *yes) ;; 38 esac
40 *) AC_DEFINE([MBRTOWC_NUL_RETVAL_BUG], [1], 39 case "$gl_cv_func_mbrtowc_nul_retval" in
41 [Define if the mbrtowc function does not return 0 for a NUL character.]) 40 *yes) ;;
42 REPLACE_MBRTOWC=1 41 *) AC_DEFINE([MBRTOWC_NUL_RETVAL_BUG], [1],
43 ;; 42 [Define if the mbrtowc function does not return 0 for a NUL character.])
44 esac 43 REPLACE_MBRTOWC=1
44 ;;
45 esac
46 fi
45 fi 47 fi
46 if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then 48 if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then
47 gl_REPLACE_WCHAR_H 49 gl_REPLACE_WCHAR_H
@@ -156,6 +158,7 @@ changequote([,])dnl
156 if test $LOCALE_ZH_CN != none; then 158 if test $LOCALE_ZH_CN != none; then
157 AC_TRY_RUN([ 159 AC_TRY_RUN([
158#include <locale.h> 160#include <locale.h>
161#include <stdlib.h>
159#include <string.h> 162#include <string.h>
160#include <wchar.h> 163#include <wchar.h>
161int main () 164int main ()
diff --git a/gl/m4/mbsinit.m4 b/gl/m4/mbsinit.m4
index 03b055c..46c106f 100644
--- a/gl/m4/mbsinit.m4
+++ b/gl/m4/mbsinit.m4
@@ -1,5 +1,5 @@
1# mbsinit.m4 serial 3 1# mbsinit.m4 serial 4
2dnl Copyright (C) 2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2008, 2010 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,12 +10,14 @@ AC_DEFUN([gl_FUNC_MBSINIT],
10 10
11 AC_REQUIRE([AC_TYPE_MBSTATE_T]) 11 AC_REQUIRE([AC_TYPE_MBSTATE_T])
12 gl_MBSTATE_T_BROKEN 12 gl_MBSTATE_T_BROKEN
13 if test $REPLACE_MBSTATE_T = 1; then 13
14 REPLACE_MBSINIT=1
15 fi
16 AC_CHECK_FUNCS_ONCE([mbsinit]) 14 AC_CHECK_FUNCS_ONCE([mbsinit])
17 if test $ac_cv_func_mbsinit = no; then 15 if test $ac_cv_func_mbsinit = no; then
18 HAVE_MBSINIT=0 16 HAVE_MBSINIT=0
17 else
18 if test $REPLACE_MBSTATE_T = 1; then
19 REPLACE_MBSINIT=1
20 fi
19 fi 21 fi
20 if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then 22 if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then
21 gl_REPLACE_WCHAR_H 23 gl_REPLACE_WCHAR_H
diff --git a/gl/m4/mbstate_t.m4 b/gl/m4/mbstate_t.m4
index d4ec6f0..3e2df29 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 12
2dnl Copyright (C) 2000-2002, 2008, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2008-2010 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,17 +18,17 @@ AC_DEFUN([AC_TYPE_MBSTATE_T],
18 18
19 AC_CACHE_CHECK([for mbstate_t], [ac_cv_type_mbstate_t], 19 AC_CACHE_CHECK([for mbstate_t], [ac_cv_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# include <wchar.h>]],
24 [[mbstate_t x; return sizeof x;]])], 24 [[mbstate_t x; return sizeof x;]])],
25 [ac_cv_type_mbstate_t=yes], 25 [ac_cv_type_mbstate_t=yes],
26 [ac_cv_type_mbstate_t=no])]) 26 [ac_cv_type_mbstate_t=no])])
27 if test $ac_cv_type_mbstate_t = yes; then 27 if test $ac_cv_type_mbstate_t = yes; then
28 AC_DEFINE([HAVE_MBSTATE_T], [1], 28 AC_DEFINE([HAVE_MBSTATE_T], [1],
29 [Define to 1 if <wchar.h> declares mbstate_t.]) 29 [Define to 1 if <wchar.h> declares mbstate_t.])
30 else 30 else
31 AC_DEFINE([mbstate_t], [int], 31 AC_DEFINE([mbstate_t], [int],
32 [Define to a type if <wchar.h> does not define.]) 32 [Define to a type if <wchar.h> does not define.])
33 fi 33 fi
34]) 34])
diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4
new file mode 100644
index 0000000..ab773b8
--- /dev/null
+++ b/gl/m4/memchr.m4
@@ -0,0 +1,85 @@
1# memchr.m4 serial 8
2dnl Copyright (C) 2002-2004, 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_ONCE([gl_FUNC_MEMCHR],
8[
9 dnl Check for prerequisites for memory fence checks.
10 gl_FUNC_MMAP_ANON
11 AC_CHECK_HEADERS_ONCE([sys/mman.h])
12 AC_CHECK_FUNCS_ONCE([mprotect])
13
14 dnl These days, we assume memchr is present. But just in case...
15 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
16 AC_CHECK_FUNCS_ONCE([memchr])
17 if test $ac_cv_func_memchr = yes; then
18 # Detect platform-specific bugs in some versions of glibc:
19 # memchr should not dereference anything with length 0
20 # http://bugzilla.redhat.com/499689
21 # memchr should not dereference overestimated length after a match
22 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737
23 # http://sourceware.org/bugzilla/show_bug.cgi?id=10162
24 # Assume that memchr works on platforms that lack mprotect.
25 AC_CACHE_CHECK([whether memchr works], [gl_cv_func_memchr_works],
26 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
27#include <string.h>
28#if HAVE_SYS_MMAN_H
29# include <fcntl.h>
30# include <unistd.h>
31# include <sys/types.h>
32# include <sys/mman.h>
33# ifndef MAP_FILE
34# define MAP_FILE 0
35# endif
36#endif
37]], [[
38 char *fence = NULL;
39#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
40# if HAVE_MAP_ANONYMOUS
41 const int flags = MAP_ANONYMOUS | MAP_PRIVATE;
42 const int fd = -1;
43# else /* !HAVE_MAP_ANONYMOUS */
44 const int flags = MAP_FILE | MAP_PRIVATE;
45 int fd = open ("/dev/zero", O_RDONLY, 0666);
46 if (fd >= 0)
47# endif
48 {
49 int pagesize = getpagesize ();
50 char *two_pages =
51 (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
52 flags, fd, 0);
53 if (two_pages != (char *)(-1)
54 && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
55 fence = two_pages + pagesize;
56 }
57#endif
58 if (fence)
59 {
60 if (memchr (fence, 0, 0))
61 return 1;
62 strcpy (fence - 9, "12345678");
63 if (memchr (fence - 9, 0, 79) != fence - 1)
64 return 2;
65 }
66 return 0;
67]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no],
68 [dnl Be pessimistic for now.
69 gl_cv_func_memchr_works="guessing no"])])
70 if test "$gl_cv_func_memchr_works" != yes; then
71 REPLACE_MEMCHR=1
72 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
80])
81
82# Prerequisites of lib/memchr.c.
83AC_DEFUN([gl_PREREQ_MEMCHR], [
84 AC_CHECK_HEADERS([bp-sym.h])
85])
diff --git a/gl/m4/mktime.m4 b/gl/m4/mktime.m4
index 1e926e8..44b8d87 100644
--- a/gl/m4/mktime.m4
+++ b/gl/m4/mktime.m4
@@ -1,5 +1,6 @@
1# serial 15 1# serial 15
2dnl Copyright (C) 2002-2003, 2005-2007, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2003, 2005-2007, 2009-2010 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.
@@ -85,8 +86,8 @@ static int
85mktime_test (time_t now) 86mktime_test (time_t now)
86{ 87{
87 return (mktime_test1 (now) 88 return (mktime_test1 (now)
88 && mktime_test1 ((time_t) (time_t_max - now)) 89 && mktime_test1 ((time_t) (time_t_max - now))
89 && mktime_test1 ((time_t) (time_t_min + now))); 90 && mktime_test1 ((time_t) (time_t_min + now)));
90} 91}
91 92
92static int 93static int
@@ -116,17 +117,17 @@ bigtime_test (int j)
116 { 117 {
117 struct tm *lt = localtime (&now); 118 struct tm *lt = localtime (&now);
118 if (! (lt 119 if (! (lt
119 && lt->tm_year == tm.tm_year 120 && lt->tm_year == tm.tm_year
120 && lt->tm_mon == tm.tm_mon 121 && lt->tm_mon == tm.tm_mon
121 && lt->tm_mday == tm.tm_mday 122 && lt->tm_mday == tm.tm_mday
122 && lt->tm_hour == tm.tm_hour 123 && lt->tm_hour == tm.tm_hour
123 && lt->tm_min == tm.tm_min 124 && lt->tm_min == tm.tm_min
124 && lt->tm_sec == tm.tm_sec 125 && lt->tm_sec == tm.tm_sec
125 && lt->tm_yday == tm.tm_yday 126 && lt->tm_yday == tm.tm_yday
126 && lt->tm_wday == tm.tm_wday 127 && lt->tm_wday == tm.tm_wday
127 && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst) 128 && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
128 == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst)))) 129 == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
129 return 0; 130 return 0;
130 } 131 }
131 return 1; 132 return 1;
132} 133}
@@ -158,7 +159,7 @@ year_2050_test ()
158 to the correct answer that we can assume the discrepancy is 159 to the correct answer that we can assume the discrepancy is
159 due to leap seconds. */ 160 due to leap seconds. */
160 return (t == (time_t) -1 161 return (t == (time_t) -1
161 || (0 < t && answer - 120 <= t && t <= answer + 120)); 162 || (0 < t && answer - 120 <= t && t <= answer + 120));
162} 163}
163 164
164int 165int
@@ -176,7 +177,7 @@ main ()
176 { 177 {
177 t = (time_t_max << 1) + 1; 178 t = (time_t_max << 1) + 1;
178 if (t <= time_t_max) 179 if (t <= time_t_max)
179 break; 180 break;
180 time_t_max = t; 181 time_t_max = t;
181 } 182 }
182 time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max; 183 time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max;
@@ -185,29 +186,29 @@ main ()
185 for (i = 0; i < N_STRINGS; i++) 186 for (i = 0; i < N_STRINGS; i++)
186 { 187 {
187 if (tz_strings[i]) 188 if (tz_strings[i])
188 putenv (tz_strings[i]); 189 putenv (tz_strings[i]);
189 190
190 for (t = 0; t <= time_t_max - delta; t += delta) 191 for (t = 0; t <= time_t_max - delta; t += delta)
191 if (! mktime_test (t)) 192 if (! mktime_test (t))
192 return 1; 193 return 1;
193 if (! (mktime_test ((time_t) 1) 194 if (! (mktime_test ((time_t) 1)
194 && mktime_test ((time_t) (60 * 60)) 195 && mktime_test ((time_t) (60 * 60))
195 && mktime_test ((time_t) (60 * 60 * 24)))) 196 && mktime_test ((time_t) (60 * 60 * 24))))
196 return 1; 197 return 1;
197 198
198 for (j = 1; ; j <<= 1) 199 for (j = 1; ; j <<= 1)
199 if (! bigtime_test (j)) 200 if (! bigtime_test (j))
200 return 1; 201 return 1;
201 else if (INT_MAX / 2 < j) 202 else if (INT_MAX / 2 < j)
202 break; 203 break;
203 if (! bigtime_test (INT_MAX)) 204 if (! bigtime_test (INT_MAX))
204 return 1; 205 return 1;
205 } 206 }
206 return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ()); 207 return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ());
207}]])], 208}]])],
208 [ac_cv_func_working_mktime=yes], 209 [ac_cv_func_working_mktime=yes],
209 [ac_cv_func_working_mktime=no], 210 [ac_cv_func_working_mktime=no],
210 [ac_cv_func_working_mktime=no])]) 211 [ac_cv_func_working_mktime=no])])
211if test $ac_cv_func_working_mktime = no; then 212if test $ac_cv_func_working_mktime = no; then
212 AC_LIBOBJ([mktime]) 213 AC_LIBOBJ([mktime])
213fi 214fi
@@ -215,12 +216,14 @@ fi
215 216
216AC_DEFUN([gl_FUNC_MKTIME], 217AC_DEFUN([gl_FUNC_MKTIME],
217[ 218[
219 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
218 AC_FUNC_MKTIME 220 AC_FUNC_MKTIME
219 dnl Note: AC_FUNC_MKTIME does AC_LIBOBJ([mktime]). 221 dnl Note: AC_FUNC_MKTIME does AC_LIBOBJ([mktime]).
220 if test $ac_cv_func_working_mktime = no; then 222 if test $ac_cv_func_working_mktime = no; then
221 AC_DEFINE([mktime], [rpl_mktime], 223 REPLACE_MKTIME=1
222 [Define to rpl_mktime if the replacement function should be used.])
223 gl_PREREQ_MKTIME 224 gl_PREREQ_MKTIME
225 else
226 REPLACE_MKTIME=0
224 fi 227 fi
225]) 228])
226 229
diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4
new file mode 100644
index 0000000..a6b7b9a
--- /dev/null
+++ b/gl/m4/mmap-anon.m4
@@ -0,0 +1,59 @@
1# mmap-anon.m4 serial 8
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
7# Detect how mmap can be used to create anonymous (not file-backed) memory
8# mappings.
9# - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS
10# and MAP_ANON exist and have the same value.
11# - On HP-UX, only MAP_ANONYMOUS exists.
12# - On MacOS X, FreeBSD, NetBSD, OpenBSD, only MAP_ANON exists.
13# - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be
14# used.
15
16AC_DEFUN([gl_FUNC_MMAP_ANON],
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.
23 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
24
25 # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it
26 # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is
27 # irrelevant for anonymous mappings.
28 AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no])
29
30 # Try to allow MAP_ANONYMOUS.
31 gl_have_mmap_anonymous=no
32 if test $gl_have_mmap = yes; then
33 AC_MSG_CHECKING([for MAP_ANONYMOUS])
34 AC_EGREP_CPP([I cant identify this map.], [
35#include <sys/mman.h>
36#ifdef MAP_ANONYMOUS
37 I cant identify this map.
38#endif
39],
40 [gl_have_mmap_anonymous=yes])
41 if test $gl_have_mmap_anonymous != yes; then
42 AC_EGREP_CPP([I cant identify this map.], [
43#include <sys/mman.h>
44#ifdef MAP_ANON
45 I cant identify this map.
46#endif
47],
48 [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON],
49 [Define to a substitute value for mmap()'s MAP_ANONYMOUS flag.])
50 gl_have_mmap_anonymous=yes])
51 fi
52 AC_MSG_RESULT([$gl_have_mmap_anonymous])
53 if test $gl_have_mmap_anonymous = yes; then
54 AC_DEFINE([HAVE_MAP_ANONYMOUS], [1],
55 [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including
56 config.h and <sys/mman.h>.])
57 fi
58 fi
59])
diff --git a/gl/m4/mode_t.m4 b/gl/m4/mode_t.m4
new file mode 100644
index 0000000..3178dfd
--- /dev/null
+++ b/gl/m4/mode_t.m4
@@ -0,0 +1,26 @@
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 f62c57a..f2d5950 100644
--- a/gl/m4/mountlist.m4
+++ b/gl/m4/mountlist.m4
@@ -1,5 +1,5 @@
1# serial 10 1# serial 10
2dnl Copyright (C) 2002-2006, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2006, 2009-2010 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.
7AC_DEFUN([gl_MOUNTLIST], 7AC_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 11 if test $gl_cv_list_mounted_fs = yes; then
12 AC_LIBOBJ([mountlist]) 12 AC_LIBOBJ([mountlist])
13 gl_PREREQ_MOUNTLIST_EXTRA 13 gl_PREREQ_MOUNTLIST_EXTRA
diff --git a/gl/m4/multiarch.m4 b/gl/m4/multiarch.m4
index ec377ba..389bd2b 100644
--- a/gl/m4/multiarch.m4
+++ b/gl/m4/multiarch.m4
@@ -1,5 +1,5 @@
1# multiarch.m4 serial 5 1# multiarch.m4 serial 5
2dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2008, 2009, 2010 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/netdb_h.m4 b/gl/m4/netdb_h.m4
index 5a12251..40ba8f6 100644
--- a/gl/m4/netdb_h.m4
+++ b/gl/m4/netdb_h.m4
@@ -1,5 +1,5 @@
1# netdb_h.m4 serial 5 1# netdb_h.m4 serial 7
2dnl Copyright (C) 2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2008, 2009, 2010 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_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])
10 gl_CHECK_NEXT_HEADERS([netdb.h]) 11 gl_CHECK_NEXT_HEADERS([netdb.h])
11 if test $ac_cv_header_netdb_h = yes; then 12 if test $ac_cv_header_netdb_h = yes; then
12 AC_COMPILE_IFELSE( 13 AC_COMPILE_IFELSE(
@@ -30,7 +31,7 @@ AC_DEFUN([gl_NETDB_MODULE_INDICATOR],
30[ 31[
31 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 32 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
32 AC_REQUIRE([gl_NETDB_H_DEFAULTS]) 33 AC_REQUIRE([gl_NETDB_H_DEFAULTS])
33 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 34 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
34]) 35])
35 36
36AC_DEFUN([gl_NETDB_H_DEFAULTS], 37AC_DEFUN([gl_NETDB_H_DEFAULTS],
diff --git a/gl/m4/netinet_in_h.m4 b/gl/m4/netinet_in_h.m4
index 47fd9cc..cc7a44c 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 4
2dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2006-2010 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/nl_langinfo.m4 b/gl/m4/nl_langinfo.m4
new file mode 100644
index 0000000..ad456a2
--- /dev/null
+++ b/gl/m4/nl_langinfo.m4
@@ -0,0 +1,25 @@
1# nl_langinfo.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
7AC_DEFUN([gl_FUNC_NL_LANGINFO],
8[
9 AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
10 AC_REQUIRE([gl_LANGINFO_H])
11 AC_CHECK_FUNCS_ONCE([nl_langinfo])
12 if test $ac_cv_func_nl_langinfo = yes; then
13 if test $HAVE_LANGINFO_CODESET = 1 && test $HAVE_LANGINFO_ERA = 1; then
14 :
15 else
16 REPLACE_NL_LANGINFO=1
17 AC_DEFINE([REPLACE_NL_LANGINFO], [1],
18 [Define if nl_langinfo exists but is overridden by gnulib.])
19 AC_LIBOBJ([nl_langinfo])
20 fi
21 else
22 HAVE_NL_LANGINFO=0
23 AC_LIBOBJ([nl_langinfo])
24 fi
25])
diff --git a/gl/m4/nls.m4 b/gl/m4/nls.m4
index 0b36434..003704c 100644
--- a/gl/m4/nls.m4
+++ b/gl/m4/nls.m4
@@ -1,5 +1,6 @@
1# nls.m4 serial 5 (gettext-0.18) 1# nls.m4 serial 5 (gettext-0.18)
2dnl Copyright (C) 1995-2003, 2005-2006, 2008, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 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.
diff --git a/gl/m4/onceonly.m4 b/gl/m4/onceonly.m4
index 108cd6c..4a3cd84 100644
--- a/gl/m4/onceonly.m4
+++ b/gl/m4/onceonly.m4
@@ -1,5 +1,6 @@
1# onceonly.m4 serial 6 1# onceonly.m4 serial 6
2dnl Copyright (C) 2002-2003, 2005-2006, 2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2003, 2005-2006, 2008-2010 Free Software Foundation,
3dnl Inc.
3dnl This file is free software, distributed under the terms of the GNU 4dnl This file is free software, distributed under the terms of the GNU
4dnl General Public License. As a special exception to the GNU General 5dnl General Public License. As a special exception to the GNU General
5dnl Public License, this file may be distributed as part of a program 6dnl Public License, this file may be distributed as part of a program
diff --git a/gl/m4/open.m4 b/gl/m4/open.m4
index 6e286c9..d705b3a 100644
--- a/gl/m4/open.m4
+++ b/gl/m4/open.m4
@@ -1,5 +1,5 @@
1# open.m4 serial 5 1# open.m4 serial 8
2dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2010 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,10 +13,15 @@ AC_DEFUN([gl_FUNC_OPEN],
13 ;; 13 ;;
14 *) 14 *)
15 dnl open("foo/") should not create a file when the file name has a 15 dnl open("foo/") should not create a file when the file name has a
16 dnl trailing slash. 16 dnl trailing slash. FreeBSD only has the problem on symlinks.
17 AC_CHECK_FUNCS_ONCE([lstat])
17 AC_CACHE_CHECK([whether open recognizes a trailing slash], 18 AC_CACHE_CHECK([whether open recognizes a trailing slash],
18 [gl_cv_func_open_slash], 19 [gl_cv_func_open_slash],
19 [ 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
20 AC_TRY_RUN([ 25 AC_TRY_RUN([
21#include <fcntl.h> 26#include <fcntl.h>
22#if HAVE_UNISTD_H 27#if HAVE_UNISTD_H
@@ -24,18 +29,22 @@ AC_DEFUN([gl_FUNC_OPEN],
24#endif 29#endif
25int main () 30int main ()
26{ 31{
32#if HAVE_LSTAT
33 if (open ("conftest.lnk/", O_RDONLY) != -1) return 2;
34#endif
27 return open ("conftest.sl/", O_CREAT, 0600) >= 0; 35 return open ("conftest.sl/", O_CREAT, 0600) >= 0;
28}], [gl_cv_func_open_slash=yes], [gl_cv_func_open_slash=no], 36}], [gl_cv_func_open_slash=yes], [gl_cv_func_open_slash=no],
29 [ 37 [
30changequote(,)dnl 38changequote(,)dnl
31 case "$host_os" in 39 case "$host_os" in
40 freebsd*) gl_cv_func_open_slash="guessing no" ;;
32 solaris2.[0-9]*) gl_cv_func_open_slash="guessing no" ;; 41 solaris2.[0-9]*) gl_cv_func_open_slash="guessing no" ;;
33 hpux*) gl_cv_func_open_slash="guessing no" ;; 42 hpux*) gl_cv_func_open_slash="guessing no" ;;
34 *) gl_cv_func_open_slash="guessing yes" ;; 43 *) gl_cv_func_open_slash="guessing yes" ;;
35 esac 44 esac
36changequote([,])dnl 45changequote([,])dnl
37 ]) 46 ])
38 rm -f conftest.sl 47 rm -f conftest.sl conftest.tmp conftest.lnk
39 ]) 48 ])
40 case "$gl_cv_func_open_slash" in 49 case "$gl_cv_func_open_slash" in
41 *no) 50 *no)
@@ -51,16 +60,15 @@ changequote([,])dnl
51AC_DEFUN([gl_REPLACE_OPEN], 60AC_DEFUN([gl_REPLACE_OPEN],
52[ 61[
53 AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) 62 AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
54 if test $REPLACE_OPEN != 1; then
55 AC_LIBOBJ([open])
56 gl_PREREQ_OPEN
57 fi
58 REPLACE_OPEN=1 63 REPLACE_OPEN=1
64 AC_LIBOBJ([open])
65 gl_PREREQ_OPEN
59]) 66])
60 67
61# Prerequisites of lib/open.c. 68# Prerequisites of lib/open.c.
62AC_DEFUN([gl_PREREQ_OPEN], 69AC_DEFUN([gl_PREREQ_OPEN],
63[ 70[
64 AC_REQUIRE([AC_C_INLINE]) 71 AC_REQUIRE([AC_C_INLINE])
72 AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])
65 : 73 :
66]) 74])
diff --git a/gl/m4/po.m4 b/gl/m4/po.m4
index 2284fa5..960efe1 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 17 (gettext-0.18)
2dnl Copyright (C) 1995-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 1995-2010 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/printf-posix.m4 b/gl/m4/printf-posix.m4
index 5922d27..1eacf95 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 5 (gettext-0.18)
2dnl Copyright (C) 2003, 2007, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007, 2009-2010 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/printf.m4 b/gl/m4/printf.m4
index 87aa45c..ebca536 100644
--- a/gl/m4/printf.m4
+++ b/gl/m4/printf.m4
@@ -1,5 +1,5 @@
1# printf.m4 serial 33 1# printf.m4 serial 33
2dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007-2010 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/progtest.m4 b/gl/m4/progtest.m4
index e1d445d..2d804ac 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 6 (gettext-0.18)
2dnl Copyright (C) 1996-2003, 2005, 2008, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 1996-2003, 2005, 2008-2010 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/regex.m4 b/gl/m4/regex.m4
index aef53d2..95784e4 100644
--- a/gl/m4/regex.m4
+++ b/gl/m4/regex.m4
@@ -1,7 +1,7 @@
1# serial 54 1# serial 56
2 2
3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
4# 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 4# 2007, 2008, 2009, 2010 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,
@@ -18,146 +18,154 @@ AC_DEFUN([gl_REGEX],
18 18
19 AC_ARG_WITH([included-regex], 19 AC_ARG_WITH([included-regex],
20 [AS_HELP_STRING([--without-included-regex], 20 [AS_HELP_STRING([--without-included-regex],
21 [don't compile regex; this is the default on systems 21 [don't compile regex; this is the default on systems
22 with recent-enough versions of the GNU C Library 22 with recent-enough versions of the GNU C Library
23 (use with caution on other systems).])]) 23 (use with caution on other systems).])])
24 24
25 case $with_included_regex in #( 25 case $with_included_regex in #(
26 yes|no) ac_use_included_regex=$with_included_regex 26 yes|no) ac_use_included_regex=$with_included_regex
27 ;; 27 ;;
28 '') 28 '')
29 # If the system regex support is good enough that it passes the 29 # If the system regex support is good enough that it passes the
30 # following run test, then default to *not* using the included regex.c. 30 # 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 31 # If cross compiling, assume the test would fail and use the included
32 # regex.c. 32 # regex.c.
33 AC_CACHE_CHECK([for working re_compile_pattern], 33 AC_CACHE_CHECK([for working re_compile_pattern],
34 [gl_cv_func_re_compile_pattern_working], 34 [gl_cv_func_re_compile_pattern_working],
35 [AC_RUN_IFELSE( 35 [AC_RUN_IFELSE(
36 [AC_LANG_PROGRAM( 36 [AC_LANG_PROGRAM(
37 [AC_INCLUDES_DEFAULT[ 37 [AC_INCLUDES_DEFAULT[
38 #if HAVE_LOCALE_H 38 #if HAVE_LOCALE_H
39 #include <locale.h> 39 #include <locale.h>
40 #endif 40 #endif
41 #include <limits.h> 41 #include <limits.h>
42 #include <regex.h> 42 #include <regex.h>
43 ]], 43 ]],
44 [[static struct re_pattern_buffer regex; 44 [[static struct re_pattern_buffer regex;
45 unsigned char folded_chars[UCHAR_MAX + 1]; 45 unsigned char folded_chars[UCHAR_MAX + 1];
46 int i; 46 int i;
47 const char *s; 47 const char *s;
48 struct re_registers regs; 48 struct re_registers regs;
49 49
50 #if HAVE_LOCALE_H 50 #if HAVE_LOCALE_H
51 /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html 51 /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html
52 This test needs valgrind to catch the bug on Debian 52 This test needs valgrind to catch the bug on Debian
53 GNU/Linux 3.1 x86, but it might catch the bug better 53 GNU/Linux 3.1 x86, but it might catch the bug better
54 on other platforms and it shouldn't hurt to try the 54 on other platforms and it shouldn't hurt to try the
55 test here. */ 55 test here. */
56 if (setlocale (LC_ALL, "en_US.UTF-8")) 56 if (setlocale (LC_ALL, "en_US.UTF-8"))
57 { 57 {
58 static char const pat[] = "insert into"; 58 static char const pat[] = "insert into";
59 static char const data[] = 59 static char const data[] =
60 "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK"; 60 "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK";
61 re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE 61 re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE
62 | RE_ICASE); 62 | RE_ICASE);
63 memset (&regex, 0, sizeof regex); 63 memset (&regex, 0, sizeof regex);
64 s = re_compile_pattern (pat, sizeof pat - 1, &regex); 64 s = re_compile_pattern (pat, sizeof pat - 1, &regex);
65 if (s) 65 if (s)
66 return 1; 66 return 1;
67 if (re_search (&regex, data, sizeof data - 1, 67 if (re_search (&regex, data, sizeof data - 1,
68 0, sizeof data - 1, &regs) 68 0, sizeof data - 1, &regs)
69 != -1) 69 != -1)
70 return 1; 70 return 1;
71 if (! setlocale (LC_ALL, "C")) 71 if (! setlocale (LC_ALL, "C"))
72 return 1; 72 return 1;
73 } 73 }
74 #endif 74 #endif
75 75
76 /* This test is from glibc bug 3957, reported by Andrew Mackey. */ 76 /* This test is from glibc bug 3957, reported by Andrew Mackey. */
77 re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE); 77 re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE);
78 memset (&regex, 0, sizeof regex); 78 memset (&regex, 0, sizeof regex);
79 s = re_compile_pattern ("a[^x]b", 6, &regex); 79 s = re_compile_pattern ("a[^x]b", 6, &regex);
80 if (s) 80 if (s)
81 return 1; 81 return 1;
82 82
83 /* This should fail, but succeeds for glibc-2.5. */ 83 /* This should fail, but succeeds for glibc-2.5. */
84 if (re_search (&regex, "a\nb", 3, 0, 3, &regs) != -1) 84 if (re_search (&regex, "a\nb", 3, 0, 3, &regs) != -1)
85 return 1; 85 return 1;
86 86
87 /* This regular expression is from Spencer ere test number 75 87 /* This regular expression is from Spencer ere test number 75
88 in grep-2.3. */ 88 in grep-2.3. */
89 re_set_syntax (RE_SYNTAX_POSIX_EGREP); 89 re_set_syntax (RE_SYNTAX_POSIX_EGREP);
90 memset (&regex, 0, sizeof regex); 90 memset (&regex, 0, sizeof regex);
91 for (i = 0; i <= UCHAR_MAX; i++) 91 for (i = 0; i <= UCHAR_MAX; i++)
92 folded_chars[i] = i; 92 folded_chars[i] = i;
93 regex.translate = folded_chars; 93 regex.translate = folded_chars;
94 s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, &regex); 94 s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, &regex);
95 /* This should fail with _Invalid character class name_ error. */ 95 /* This should fail with _Invalid character class name_ error. */
96 if (!s) 96 if (!s)
97 return 1; 97 return 1;
98 98
99 /* This should succeed, but does not for glibc-2.1.3. */ 99 /* Ensure that [b-a] is diagnosed as invalid, when
100 memset (&regex, 0, sizeof regex); 100 using RE_NO_EMPTY_RANGES. */
101 s = re_compile_pattern ("{1", 2, &regex); 101 re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_NO_EMPTY_RANGES);
102 102 memset (&regex, 0, sizeof regex);
103 if (s) 103 s = re_compile_pattern ("a[b-a]", 6, &regex);
104 return 1; 104 if (s == 0)
105 105 return 1;
106 /* The following example is derived from a problem report 106
107 against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */ 107 /* This should succeed, but does not for glibc-2.1.3. */
108 memset (&regex, 0, sizeof regex); 108 memset (&regex, 0, sizeof regex);
109 s = re_compile_pattern ("[an\371]*n", 7, &regex); 109 s = re_compile_pattern ("{1", 2, &regex);
110 if (s) 110
111 return 1; 111 if (s)
112 112 return 1;
113 /* This should match, but does not for glibc-2.2.1. */ 113
114 if (re_match (&regex, "an", 2, 0, &regs) != 2) 114 /* The following example is derived from a problem report
115 return 1; 115 against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */
116 116 memset (&regex, 0, sizeof regex);
117 memset (&regex, 0, sizeof regex); 117 s = re_compile_pattern ("[an\371]*n", 7, &regex);
118 s = re_compile_pattern ("x", 1, &regex); 118 if (s)
119 if (s) 119 return 1;
120 return 1; 120
121 121 /* This should match, but does not for glibc-2.2.1. */
122 /* glibc-2.2.93 does not work with a negative RANGE argument. */ 122 if (re_match (&regex, "an", 2, 0, &regs) != 2)
123 if (re_search (&regex, "wxy", 3, 2, -2, &regs) != 1) 123 return 1;
124 return 1; 124
125 125 memset (&regex, 0, sizeof regex);
126 /* The version of regex.c in older versions of gnulib 126 s = re_compile_pattern ("x", 1, &regex);
127 ignored RE_ICASE. Detect that problem too. */ 127 if (s)
128 re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE); 128 return 1;
129 memset (&regex, 0, sizeof regex); 129
130 s = re_compile_pattern ("x", 1, &regex); 130 /* glibc-2.2.93 does not work with a negative RANGE argument. */
131 if (s) 131 if (re_search (&regex, "wxy", 3, 2, -2, &regs) != 1)
132 return 1; 132 return 1;
133 133
134 if (re_search (&regex, "WXY", 3, 0, 3, &regs) < 0) 134 /* The version of regex.c in older versions of gnulib
135 return 1; 135 ignored RE_ICASE. Detect that problem too. */
136 136 re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE);
137 /* Catch a bug reported by Vin Shelton in 137 memset (&regex, 0, sizeof regex);
138 http://lists.gnu.org/archive/html/bug-coreutils/2007-06/msg00089.html 138 s = re_compile_pattern ("x", 1, &regex);
139 */ 139 if (s)
140 re_set_syntax (RE_SYNTAX_POSIX_BASIC 140 return 1;
141 & ~RE_CONTEXT_INVALID_DUP 141
142 & ~RE_NO_EMPTY_RANGES); 142 if (re_search (&regex, "WXY", 3, 0, 3, &regs) < 0)
143 memset (&regex, 0, sizeof regex); 143 return 1;
144 s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, &regex); 144
145 if (s) 145 /* Catch a bug reported by Vin Shelton in
146 return 1; 146 http://lists.gnu.org/archive/html/bug-coreutils/2007-06/msg00089.html
147 147 */
148 /* REG_STARTEND was added to glibc on 2004-01-15. 148 re_set_syntax (RE_SYNTAX_POSIX_BASIC
149 Reject older versions. */ 149 & ~RE_CONTEXT_INVALID_DUP
150 if (! REG_STARTEND) 150 & ~RE_NO_EMPTY_RANGES);
151 return 1; 151 memset (&regex, 0, sizeof regex);
152 152 s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, &regex);
153 /* Reject hosts whose regoff_t values are too narrow. 153 if (s)
154 These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t 154 return 1;
155 and 32-bit int. */ 155
156 if (sizeof (regoff_t) < sizeof (ptrdiff_t) 156 /* REG_STARTEND was added to glibc on 2004-01-15.
157 || sizeof (regoff_t) < sizeof (ssize_t)) 157 Reject older versions. */
158 return 1; 158 if (! REG_STARTEND)
159 159 return 1;
160 return 0;]])], 160
161 /* Reject hosts whose regoff_t values are too narrow.
162 These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t
163 and 32-bit int. */
164 if (sizeof (regoff_t) < sizeof (ptrdiff_t)
165 || sizeof (regoff_t) < sizeof (ssize_t))
166 return 1;
167
168 return 0;]])],
161 [gl_cv_func_re_compile_pattern_working=yes], 169 [gl_cv_func_re_compile_pattern_working=yes],
162 [gl_cv_func_re_compile_pattern_working=no], 170 [gl_cv_func_re_compile_pattern_working=no],
163 dnl When crosscompiling, assume it is not working. 171 dnl When crosscompiling, assume it is not working.
@@ -213,6 +221,7 @@ AC_DEFUN([gl_REGEX],
213AC_DEFUN([gl_PREREQ_REGEX], 221AC_DEFUN([gl_PREREQ_REGEX],
214[ 222[
215 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) 223 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
224 AC_REQUIRE([AC_C_INLINE])
216 AC_REQUIRE([AC_C_RESTRICT]) 225 AC_REQUIRE([AC_C_RESTRICT])
217 AC_REQUIRE([AC_TYPE_MBSTATE_T]) 226 AC_REQUIRE([AC_TYPE_MBSTATE_T])
218 AC_CHECK_HEADERS([libintl.h]) 227 AC_CHECK_HEADERS([libintl.h])
diff --git a/gl/m4/safe-read.m4 b/gl/m4/safe-read.m4
index 7a89d0a..d087bd3 100644
--- a/gl/m4/safe-read.m4
+++ b/gl/m4/safe-read.m4
@@ -1,5 +1,6 @@
1# safe-read.m4 serial 5 1# safe-read.m4 serial 5
2dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2003, 2005-2006, 2009-2010 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.
diff --git a/gl/m4/safe-write.m4 b/gl/m4/safe-write.m4
index db119ff..2ff11d2 100644
--- a/gl/m4/safe-write.m4
+++ b/gl/m4/safe-write.m4
@@ -1,5 +1,5 @@
1# safe-write.m4 serial 3 1# safe-write.m4 serial 3
2dnl Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2005-2006, 2009-2010 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/servent.m4 b/gl/m4/servent.m4
index 242f9e3..2ed961a 100644
--- a/gl/m4/servent.m4
+++ b/gl/m4/servent.m4
@@ -1,5 +1,5 @@
1# servent.m4 serial 1 1# servent.m4 serial 1
2dnl Copyright (C) 2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2008, 2009, 2010 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/size_max.m4 b/gl/m4/size_max.m4
index e0e7b3f..ce992db 100644
--- a/gl/m4/size_max.m4
+++ b/gl/m4/size_max.m4
@@ -1,5 +1,5 @@
1# size_max.m4 serial 7 1# size_max.m4 serial 9
2dnl Copyright (C) 2003, 2005-2006, 2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2005-2006, 2008-2010 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,8 +10,7 @@ AC_DEFUN([gl_SIZE_MAX],
10[ 10[
11 AC_CHECK_HEADERS([stdint.h]) 11 AC_CHECK_HEADERS([stdint.h])
12 dnl First test whether the system already has SIZE_MAX. 12 dnl First test whether the system already has SIZE_MAX.
13 AC_MSG_CHECKING([for SIZE_MAX]) 13 AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [
14 AC_CACHE_VAL([gl_cv_size_max], [
15 gl_cv_size_max= 14 gl_cv_size_max=
16 AC_EGREP_CPP([Found it], [ 15 AC_EGREP_CPP([Found it], [
17#include <limits.h> 16#include <limits.h>
@@ -54,11 +53,19 @@ Found it
54 fi 53 fi
55 fi 54 fi
56 ]) 55 ])
57 AC_MSG_RESULT([$gl_cv_size_max])
58 if test "$gl_cv_size_max" != yes; then 56 if test "$gl_cv_size_max" != yes; then
59 AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max], 57 AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max],
60 [Define as the maximum value of type 'size_t', if the system doesn't define it.]) 58 [Define as the maximum value of type 'size_t', if the system doesn't define it.])
61 fi 59 fi
60 dnl Don't redefine SIZE_MAX in config.h if config.h is re-included after
61 dnl <stdint.h>. Remember that the #undef in AH_VERBATIM gets replaced with
62 dnl #define by AC_DEFINE_UNQUOTED.
63 AH_VERBATIM([SIZE_MAX],
64[/* Define as the maximum value of type 'size_t', if the system doesn't define
65 it. */
66#ifndef SIZE_MAX
67# undef SIZE_MAX
68#endif])
62]) 69])
63 70
64dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. 71dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
diff --git a/gl/m4/snprintf.m4 b/gl/m4/snprintf.m4
index 6021786..522b107 100644
--- a/gl/m4/snprintf.m4
+++ b/gl/m4/snprintf.m4
@@ -1,5 +1,5 @@
1# snprintf.m4 serial 5 1# snprintf.m4 serial 5
2dnl Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2004, 2007-2010 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/sockets.m4 b/gl/m4/sockets.m4
new file mode 100644
index 0000000..aefb936
--- /dev/null
+++ b/gl/m4/sockets.m4
@@ -0,0 +1,90 @@
1# sockets.m4 serial 6
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_SOCKETS],
8[
9 AC_REQUIRE([AC_C_INLINE])
10
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
85])
86
87# Prerequisites of lib/sockets.c.
88AC_DEFUN([gl_PREREQ_SOCKETS], [
89 :
90])
diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4
index b755757..2933d4b 100644
--- a/gl/m4/socklen.m4
+++ b/gl/m4/socklen.m4
@@ -1,5 +1,5 @@
1# socklen.m4 serial 6 1# socklen.m4 serial 7
2dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. 2dnl Copyright (C) 2005, 2006, 2007, 2009, 2010 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,30 +20,30 @@ AC_DEFUN([gl_TYPE_SOCKLEN_T],
20 AC_CHECK_TYPE([socklen_t], , 20 AC_CHECK_TYPE([socklen_t], ,
21 [AC_MSG_CHECKING([for socklen_t equivalent]) 21 [AC_MSG_CHECKING([for socklen_t equivalent])
22 AC_CACHE_VAL([gl_cv_socklen_t_equiv], 22 AC_CACHE_VAL([gl_cv_socklen_t_equiv],
23 [# Systems have either "struct sockaddr *" or 23 [# Systems have either "struct sockaddr *" or
24 # "void *" as the second argument to getpeername 24 # "void *" as the second argument to getpeername
25 gl_cv_socklen_t_equiv= 25 gl_cv_socklen_t_equiv=
26 for arg2 in "struct sockaddr" void; do 26 for arg2 in "struct sockaddr" void; do
27 for t in int size_t "unsigned int" "long int" "unsigned long int"; do 27 for t in int size_t "unsigned int" "long int" "unsigned long int"; do
28 AC_TRY_COMPILE( 28 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
29 [#include <sys/types.h> 29 [[#include <sys/types.h>
30 #include <sys/socket.h> 30 #include <sys/socket.h>
31 31
32 int getpeername (int, $arg2 *, $t *);], 32 int getpeername (int, $arg2 *, $t *);]],
33 [$t len; 33 [[$t len;
34 getpeername (0, 0, &len);], 34 getpeername (0, 0, &len);]])],
35 [gl_cv_socklen_t_equiv="$t"]) 35 [gl_cv_socklen_t_equiv="$t"])
36 test "$gl_cv_socklen_t_equiv" != "" && break 36 test "$gl_cv_socklen_t_equiv" != "" && break
37 done 37 done
38 test "$gl_cv_socklen_t_equiv" != "" && break 38 test "$gl_cv_socklen_t_equiv" != "" && break
39 done 39 done
40 ]) 40 ])
41 if test "$gl_cv_socklen_t_equiv" = ""; then 41 if test "$gl_cv_socklen_t_equiv" = ""; then
42 AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) 42 AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
43 fi 43 fi
44 AC_MSG_RESULT([$gl_cv_socklen_t_equiv]) 44 AC_MSG_RESULT([$gl_cv_socklen_t_equiv])
45 AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv], 45 AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
46 [type to use in place of socklen_t if not defined])], 46 [type to use in place of socklen_t if not defined])],
47 [#include <sys/types.h> 47 [#include <sys/types.h>
48 #if HAVE_SYS_SOCKET_H 48 #if HAVE_SYS_SOCKET_H
49 # include <sys/socket.h> 49 # include <sys/socket.h>
diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4
index 99ea06f..8a0c236 100644
--- a/gl/m4/sockpfaf.m4
+++ b/gl/m4/sockpfaf.m4
@@ -1,5 +1,5 @@
1# sockpfaf.m4 serial 6 1# sockpfaf.m4 serial 7
2dnl Copyright (C) 2004, 2006, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2004, 2006, 2009, 2010 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([gl_SOCKET_FAMILIES],
18 18
19 AC_MSG_CHECKING([for IPv4 sockets]) 19 AC_MSG_CHECKING([for IPv4 sockets])
20 AC_CACHE_VAL([gl_cv_socket_ipv4], 20 AC_CACHE_VAL([gl_cv_socket_ipv4],
21 [AC_TRY_COMPILE([#include <sys/types.h> 21 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
22#ifdef HAVE_SYS_SOCKET_H 22#ifdef HAVE_SYS_SOCKET_H
23#include <sys/socket.h> 23#include <sys/socket.h>
24#endif 24#endif
@@ -27,9 +27,9 @@ AC_DEFUN([gl_SOCKET_FAMILIES],
27#endif 27#endif
28#ifdef HAVE_WINSOCK2_H 28#ifdef HAVE_WINSOCK2_H
29#include <winsock2.h> 29#include <winsock2.h>
30#endif], 30#endif]],
31[int x = AF_INET; struct in_addr y; struct sockaddr_in z; 31[[int x = AF_INET; struct in_addr y; struct sockaddr_in z;
32 if (&x && &y && &z) return 0;], 32 if (&x && &y && &z) return 0;]])],
33 gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)]) 33 gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)])
34 AC_MSG_RESULT([$gl_cv_socket_ipv4]) 34 AC_MSG_RESULT([$gl_cv_socket_ipv4])
35 if test $gl_cv_socket_ipv4 = yes; then 35 if test $gl_cv_socket_ipv4 = yes; then
@@ -38,7 +38,7 @@ AC_DEFUN([gl_SOCKET_FAMILIES],
38 38
39 AC_MSG_CHECKING([for IPv6 sockets]) 39 AC_MSG_CHECKING([for IPv6 sockets])
40 AC_CACHE_VAL([gl_cv_socket_ipv6], 40 AC_CACHE_VAL([gl_cv_socket_ipv6],
41 [AC_TRY_COMPILE([#include <sys/types.h> 41 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
42#ifdef HAVE_SYS_SOCKET_H 42#ifdef HAVE_SYS_SOCKET_H
43#include <sys/socket.h> 43#include <sys/socket.h>
44#endif 44#endif
@@ -47,9 +47,9 @@ AC_DEFUN([gl_SOCKET_FAMILIES],
47#endif 47#endif
48#ifdef HAVE_WINSOCK2_H 48#ifdef HAVE_WINSOCK2_H
49#include <winsock2.h> 49#include <winsock2.h>
50#endif], 50#endif]],
51[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z; 51[[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z;
52 if (&x && &y && &z) return 0;], 52 if (&x && &y && &z) return 0;]])],
53 gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)]) 53 gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)])
54 AC_MSG_RESULT([$gl_cv_socket_ipv6]) 54 AC_MSG_RESULT([$gl_cv_socket_ipv6])
55 if test $gl_cv_socket_ipv6 = yes; then 55 if test $gl_cv_socket_ipv6 = yes; then
diff --git a/gl/m4/ssize_t.m4 b/gl/m4/ssize_t.m4
index 4eaef93..e0ccee3 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 4 (gettext-0.15)
2dnl Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2003, 2006, 2009-2010 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/stat.m4 b/gl/m4/stat.m4
new file mode 100644
index 0000000..acd32d8
--- /dev/null
+++ b/gl/m4/stat.m4
@@ -0,0 +1,63 @@
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/stdbool.m4 b/gl/m4/stdbool.m4
index 57c804a..3d672d7 100644
--- a/gl/m4/stdbool.m4
+++ b/gl/m4/stdbool.m4
@@ -1,6 +1,6 @@
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 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2006, 2009-2010 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.
@@ -38,77 +38,77 @@ AC_DEFUN([AC_HEADER_STDBOOL],
38 [AC_CACHE_CHECK([for stdbool.h that conforms to C99], 38 [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
39 [ac_cv_header_stdbool_h], 39 [ac_cv_header_stdbool_h],
40 [AC_TRY_COMPILE( 40 [AC_TRY_COMPILE(
41 [ 41 [
42 #include <stdbool.h> 42 #include <stdbool.h>
43 #ifndef bool 43 #ifndef bool
44 "error: bool is not defined" 44 "error: bool is not defined"
45 #endif 45 #endif
46 #ifndef false 46 #ifndef false
47 "error: false is not defined" 47 "error: false is not defined"
48 #endif 48 #endif
49 #if false 49 #if false
50 "error: false is not 0" 50 "error: false is not 0"
51 #endif 51 #endif
52 #ifndef true 52 #ifndef true
53 "error: true is not defined" 53 "error: true is not defined"
54 #endif 54 #endif
55 #if true != 1 55 #if true != 1
56 "error: true is not 1" 56 "error: true is not 1"
57 #endif 57 #endif
58 #ifndef __bool_true_false_are_defined 58 #ifndef __bool_true_false_are_defined
59 "error: __bool_true_false_are_defined is not defined" 59 "error: __bool_true_false_are_defined is not defined"
60 #endif 60 #endif
61 61
62 struct s { _Bool s: 1; _Bool t; } s; 62 struct s { _Bool s: 1; _Bool t; } s;
63 63
64 char a[true == 1 ? 1 : -1]; 64 char a[true == 1 ? 1 : -1];
65 char b[false == 0 ? 1 : -1]; 65 char b[false == 0 ? 1 : -1];
66 char c[__bool_true_false_are_defined == 1 ? 1 : -1]; 66 char c[__bool_true_false_are_defined == 1 ? 1 : -1];
67 char d[(bool) 0.5 == true ? 1 : -1]; 67 char d[(bool) 0.5 == true ? 1 : -1];
68 bool e = &s; 68 bool e = &s;
69 char f[(_Bool) 0.0 == false ? 1 : -1]; 69 char f[(_Bool) 0.0 == false ? 1 : -1];
70 char g[true]; 70 char g[true];
71 char h[sizeof (_Bool)]; 71 char h[sizeof (_Bool)];
72 char i[sizeof s.t]; 72 char i[sizeof s.t];
73 enum { j = false, k = true, l = false * true, m = true * 256 }; 73 enum { j = false, k = true, l = false * true, m = true * 256 };
74 _Bool n[m]; 74 _Bool n[m];
75 char o[sizeof n == m * sizeof n[0] ? 1 : -1]; 75 char o[sizeof n == m * sizeof n[0] ? 1 : -1];
76 char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; 76 char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
77 #if defined __xlc__ || defined __GNUC__ 77 #if defined __xlc__ || defined __GNUC__
78 /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 78 /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
79 reported by James Lemley on 2005-10-05; see 79 reported by James Lemley on 2005-10-05; see
80 http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html 80 http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
81 This test is not quite right, since xlc is allowed to 81 This test is not quite right, since xlc is allowed to
82 reject this program, as the initializer for xlcbug is 82 reject this program, as the initializer for xlcbug is
83 not one of the forms that C requires support for. 83 not one of the forms that C requires support for.
84 However, doing the test right would require a run-time 84 However, doing the test right would require a run-time
85 test, and that would make cross-compilation harder. 85 test, and that would make cross-compilation harder.
86 Let us hope that IBM fixes the xlc bug, and also adds 86 Let us hope that IBM fixes the xlc bug, and also adds
87 support for this kind of constant expression. In the 87 support for this kind of constant expression. In the
88 meantime, this test will reject xlc, which is OK, since 88 meantime, this test will reject xlc, which is OK, since
89 our stdbool.h substitute should suffice. We also test 89 our stdbool.h substitute should suffice. We also test
90 this with GCC, where it should work, to detect more 90 this with GCC, where it should work, to detect more
91 quickly whether someone messes up the test in the 91 quickly whether someone messes up the test in the
92 future. */ 92 future. */
93 char digs[] = "0123456789"; 93 char digs[] = "0123456789";
94 int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); 94 int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
95 #endif 95 #endif
96 /* Catch a bug in an HP-UX C compiler. See 96 /* Catch a bug in an HP-UX C compiler. See
97 http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html 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 98 http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
99 */ 99 */
100 _Bool q = true; 100 _Bool q = true;
101 _Bool *pq = &q; 101 _Bool *pq = &q;
102 ], 102 ],
103 [ 103 [
104 *pq |= q; 104 *pq |= q;
105 *pq |= ! q; 105 *pq |= ! q;
106 /* Refer to every declared value, to avoid compiler optimizations. */ 106 /* Refer to every declared value, to avoid compiler optimizations. */
107 return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l 107 return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
108 + !m + !n + !o + !p + !q + !pq); 108 + !m + !n + !o + !p + !q + !pq);
109 ], 109 ],
110 [ac_cv_header_stdbool_h=yes], 110 [ac_cv_header_stdbool_h=yes],
111 [ac_cv_header_stdbool_h=no])]) 111 [ac_cv_header_stdbool_h=no])])
112 AC_CHECK_TYPES([_Bool]) 112 AC_CHECK_TYPES([_Bool])
113 if test $ac_cv_header_stdbool_h = yes; then 113 if test $ac_cv_header_stdbool_h = yes; then
114 AC_DEFINE([HAVE_STDBOOL_H], [1], [Define to 1 if stdbool.h conforms to C99.]) 114 AC_DEFINE([HAVE_STDBOOL_H], [1], [Define to 1 if stdbool.h conforms to C99.])
diff --git a/gl/m4/stddef_h.m4 b/gl/m4/stddef_h.m4
new file mode 100644
index 0000000..c3ae569
--- /dev/null
+++ b/gl/m4/stddef_h.m4
@@ -0,0 +1,45 @@
1dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues.
2# stddef_h.m4 serial 2
3dnl Copyright (C) 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
8AC_DEFUN([gl_STDDEF_H],
9[
10 AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
11 AC_REQUIRE([gt_TYPE_WCHAR_T])
12 if test $gt_cv_c_wchar_t = no; then
13 HAVE_WCHAR_T=0
14 STDDEF_H=stddef.h
15 fi
16 AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions],
17 [gl_cv_decl_null_works],
18 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
19 int test[2 * (sizeof NULL == sizeof (void *)) -1];
20]])],
21 [gl_cv_decl_null_works=yes],
22 [gl_cv_decl_null_works=no])])
23 if test $gl_cv_decl_null_works = no; then
24 REPLACE_NULL=1
25 STDDEF_H=stddef.h
26 fi
27 if test -n "$STDDEF_H"; then
28 gl_CHECK_NEXT_HEADERS([stddef.h])
29 fi
30])
31
32AC_DEFUN([gl_STDDEF_MODULE_INDICATOR],
33[
34 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
35 AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
36 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
37])
38
39AC_DEFUN([gl_STDDEF_H_DEFAULTS],
40[
41 dnl Assume proper GNU behavior unless another module says otherwise.
42 REPLACE_NULL=0; AC_SUBST([REPLACE_NULL])
43 HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T])
44 STDDEF_H=''; AC_SUBST([STDDEF_H])
45])
diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4
index a2e8bdd..1cc57e6 100644
--- a/gl/m4/stdint.m4
+++ b/gl/m4/stdint.m4
@@ -1,5 +1,5 @@
1# stdint.m4 serial 34 1# stdint.m4 serial 34
2dnl Copyright (C) 2001-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2010 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.
@@ -396,12 +396,12 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
396 for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do 396 for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
397 case $glsuf in 397 case $glsuf in
398 '') gltype1='int';; 398 '') gltype1='int';;
399 l) gltype1='long int';; 399 l) gltype1='long int';;
400 ll) gltype1='long long int';; 400 ll) gltype1='long long int';;
401 i64) gltype1='__int64';; 401 i64) gltype1='__int64';;
402 u) gltype1='unsigned int';; 402 u) gltype1='unsigned int';;
403 ul) gltype1='unsigned long int';; 403 ul) gltype1='unsigned long int';;
404 ull) gltype1='unsigned long long int';; 404 ull) gltype1='unsigned long long int';;
405 ui64)gltype1='unsigned __int64';; 405 ui64)gltype1='unsigned __int64';;
406 esac 406 esac
407 AC_COMPILE_IFELSE( 407 AC_COMPILE_IFELSE(
diff --git a/gl/m4/stdint_h.m4 b/gl/m4/stdint_h.m4
index 82f0c24..b8e3c6c 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 8
2dnl Copyright (C) 1997-2004, 2006, 2008, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2004, 2006, 2008-2010 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/stdio_h.m4 b/gl/m4/stdio_h.m4
index 846b65d..1d1d95e 100644
--- a/gl/m4/stdio_h.m4
+++ b/gl/m4/stdio_h.m4
@@ -1,5 +1,5 @@
1# stdio_h.m4 serial 15 1# stdio_h.m4 serial 30
2dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2010 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_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_CHECK_NEXT_HEADERS([stdio.h]) 11 gl_CHECK_NEXT_HEADERS([stdio.h])
11 dnl No need to create extra modules for these functions. Everyone who uses 12 dnl No need to create extra modules for these functions. Everyone who uses
12 dnl <stdio.h> likely needs them. 13 dnl <stdio.h> likely needs them.
@@ -30,86 +31,110 @@ AC_DEFUN([gl_STDIO_H],
30 AC_LIBOBJ([stdio-write]) 31 AC_LIBOBJ([stdio-write])
31 fi 32 fi
32 ]) 33 ])
34
35 dnl Check for declarations of anything we want to poison if the
36 dnl corresponding gnulib module is not in use, and which is not
37 dnl guaranteed by C89.
38 gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
39 ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat
40 snprintf tmpfile vdprintf vsnprintf])
33]) 41])
34 42
35AC_DEFUN([gl_STDIO_MODULE_INDICATOR], 43AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
36[ 44[
37 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 45 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
38 AC_REQUIRE([gl_STDIO_H_DEFAULTS]) 46 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
39 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 47 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
48 dnl Define it also as a C macro, for the benefit of the unit tests.
49 gl_MODULE_INDICATOR_FOR_TESTS([$1])
40]) 50])
41 51
42AC_DEFUN([gl_STDIO_H_DEFAULTS], 52AC_DEFUN([gl_STDIO_H_DEFAULTS],
43[ 53[
44 GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF])
45 GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX])
46 GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF])
47 GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX])
48 GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF])
49 GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX])
50 GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF])
51 GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX])
52 GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF])
53 GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX])
54 GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF])
55 GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX])
56 GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF]) 54 GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF])
57 GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF]) 55 GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE])
58 GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) 56 GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH])
59 GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF])
60 GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
61 GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) 57 GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN])
58 GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF])
59 GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX])
60 GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE])
61 GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC])
62 GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS])
62 GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN]) 63 GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN])
63 GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) 64 GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK])
64 GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) 65 GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO])
65 GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) 66 GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL])
66 GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) 67 GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO])
67 GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH])
68 GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE])
69 GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC])
70 GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC])
71 GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR])
72 GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS])
73 GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS])
74 GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE]) 68 GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE])
75 GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM]) 69 GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM])
76 GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE]) 70 GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE])
71 GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF])
72 GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
77 GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR]) 73 GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR])
74 GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN])
75 GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF])
76 GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX])
77 GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC])
78 GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR])
79 GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS])
80 GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE])
81 GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME])
82 GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT])
83 GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF])
84 GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX])
78 GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE]) 85 GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE])
86 GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE])
87 GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF])
88 GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF])
89 GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF])
90 GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX])
91 GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF])
92 GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX])
93 GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF])
94 GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX])
79 dnl Assume proper GNU behavior unless another module says otherwise. 95 dnl Assume proper GNU behavior unless another module says otherwise.
80 REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS]) 96 HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE])
81 REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) 97 HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM])
82 REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF]) 98 HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE])
83 REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF]) 99 HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF])
84 REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF])
85 REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF])
86 HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF]) 100 HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF])
87 REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF])
88 HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) 101 HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF])
89 REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF])
90 REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF])
91 HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) 102 HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF])
92 REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF]) 103 HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
93 HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF]) 104 HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO])
94 REPLACE_VDPRINTF=0; AC_SUBST([REPLACE_VDPRINTF]) 105 HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT])
95 HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) 106 HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF])
96 REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) 107 HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF])
97 HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) 108 REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF])
98 REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF]) 109 REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE])
110 REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH])
99 REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) 111 REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN])
112 REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF])
113 REPLACE_FPURGE=0; AC_SUBST([REPLACE_FPURGE])
100 REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN]) 114 REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN])
101 HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
102 REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO])
103 REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK]) 115 REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK])
104 HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO]) 116 REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO])
105 REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO])
106 REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL]) 117 REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL])
107 REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) 118 REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO])
108 REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE]) 119 REPLACE_GETDELIM=0; AC_SUBST([REPLACE_GETDELIM])
109 HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM])
110 HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE])
111 REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE]) 120 REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE])
121 REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF])
112 REPLACE_PERROR=0; AC_SUBST([REPLACE_PERROR]) 122 REPLACE_PERROR=0; AC_SUBST([REPLACE_PERROR])
123 REPLACE_POPEN=0; AC_SUBST([REPLACE_POPEN])
124 REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF])
125 REPLACE_REMOVE=0; AC_SUBST([REPLACE_REMOVE])
126 REPLACE_RENAME=0; AC_SUBST([REPLACE_RENAME])
127 REPLACE_RENAMEAT=0; AC_SUBST([REPLACE_RENAMEAT])
128 REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF])
129 REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF])
130 REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS])
131 REPLACE_TMPFILE=0; AC_SUBST([REPLACE_TMPFILE])
132 REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF])
133 REPLACE_VDPRINTF=0; AC_SUBST([REPLACE_VDPRINTF])
134 REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF])
135 REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF])
136 REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF])
137 REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF])
113]) 138])
114 139
115dnl Code shared by fseeko and ftello. Determine if large files are supported, 140dnl Code shared by fseeko and ftello. Determine if large files are supported,
@@ -128,6 +153,6 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET],
128 choke me 153 choke me
129# endif 154# endif
130#endif]])], 155#endif]])],
131 [gl_cv_var_stdin_large_offset=yes], 156 [gl_cv_var_stdin_large_offset=yes],
132 [gl_cv_var_stdin_large_offset=no])]) 157 [gl_cv_var_stdin_large_offset=no])])
133]) 158])
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4
index b295f16..dd84796 100644
--- a/gl/m4/stdlib_h.m4
+++ b/gl/m4/stdlib_h.m4
@@ -1,5 +1,5 @@
1# stdlib_h.m4 serial 15 1# stdlib_h.m4 serial 28
2dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2010 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,41 +22,75 @@ AC_DEFUN([gl_STDLIB_H],
22 # include <random.h> 22 # include <random.h>
23 #endif 23 #endif
24 ]]) 24 ]])
25
26 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
28 dnl guaranteed by C89.
29 gl_WARN_ON_USE_PREPARE([[#include <stdlib.h>
30#if HAVE_SYS_LOADAVG_H
31# include <sys/loadavg.h>
32#endif
33#if HAVE_RANDOM_H
34# include <random.h>
35#endif
36 ]], [atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp
37 mkostemp mkostemps mkstemp mkstemps ptsname random_r initstat_r srandom_r
38 setstate_r realpath rpmatch setenv strtod strtoll strtoull unlockpt
39 unsetenv])
25]) 40])
26 41
27AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], 42AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
28[ 43[
29 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 44 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
30 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 45 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
31 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 46 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
47 dnl Define it also as a C macro, for the benefit of the unit tests.
48 gl_MODULE_INDICATOR_FOR_TESTS([$1])
32]) 49])
33 50
34AC_DEFUN([gl_STDLIB_H_DEFAULTS], 51AC_DEFUN([gl_STDLIB_H_DEFAULTS],
35[ 52[
36 GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX])
37 GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
38 GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX])
39 GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL]) 53 GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL])
54 GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX])
55 GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME])
40 GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG]) 56 GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG])
41 GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) 57 GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT])
58 GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT])
59 GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX])
42 GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) 60 GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP])
61 GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP])
62 GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS])
43 GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) 63 GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP])
64 GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS])
65 GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME])
44 GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) 66 GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV])
45 GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) 67 GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R])
68 GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
69 GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH])
46 GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) 70 GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH])
47 GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) 71 GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV])
48 GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) 72 GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD])
49 GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) 73 GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL])
50 GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) 74 GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL])
75 GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT])
51 GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) 76 GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV])
52 dnl Assume proper GNU behavior unless another module says otherwise. 77 dnl Assume proper GNU behavior unless another module says otherwise.
53 HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) 78 HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL])
54 HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX]) 79 HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX])
80 HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME])
81 HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG])
55 HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) 82 HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT])
83 HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT])
56 HAVE_MALLOC_POSIX=1; AC_SUBST([HAVE_MALLOC_POSIX]) 84 HAVE_MALLOC_POSIX=1; AC_SUBST([HAVE_MALLOC_POSIX])
57 HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) 85 HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
58 HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX]) 86 HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP])
87 HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS])
88 HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP])
89 HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS])
90 HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME])
59 HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) 91 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])
60 HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) 94 HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH])
61 HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) 95 HAVE_SETENV=1; AC_SUBST([HAVE_SETENV])
62 HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) 96 HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD])
@@ -64,10 +98,13 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
64 HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) 98 HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL])
65 HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) 99 HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA])
66 HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) 100 HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H])
101 HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT])
67 HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV]) 102 HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV])
68 HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) 103 REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
69 REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) 104 REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
70 REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) 105 REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
106 REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH])
107 REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV])
71 REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) 108 REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD])
72 VOID_UNSETENV=0; AC_SUBST([VOID_UNSETENV]) 109 REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV])
73]) 110])
diff --git a/gl/m4/strdup.m4 b/gl/m4/strdup.m4
index d7daac2..ce40c21 100644
--- a/gl/m4/strdup.m4
+++ b/gl/m4/strdup.m4
@@ -1,6 +1,6 @@
1# strdup.m4 serial 11 1# strdup.m4 serial 12
2 2
3dnl Copyright (C) 2002-2009 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2010 Free Software Foundation, Inc.
4 4
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
@@ -9,29 +9,36 @@ dnl with or without modifications, as long as this notice is preserved.
9AC_DEFUN([gl_FUNC_STRDUP], 9AC_DEFUN([gl_FUNC_STRDUP],
10[ 10[
11 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) 11 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
12 AC_REPLACE_FUNCS([strdup]) 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
13 AC_CHECK_DECLS_ONCE([strdup]) 17 AC_CHECK_DECLS_ONCE([strdup])
14 if test $ac_cv_have_decl_strdup = no; then 18 if test $ac_cv_have_decl_strdup = no; then
15 HAVE_DECL_STRDUP=0 19 HAVE_DECL_STRDUP=0
16 fi 20 fi
17 gl_PREREQ_STRDUP
18]) 21])
19 22
20AC_DEFUN([gl_FUNC_STRDUP_POSIX], 23AC_DEFUN([gl_FUNC_STRDUP_POSIX],
21[ 24[
22 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) 25 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
23 AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) 26 AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
24 if test $gl_cv_func_malloc_posix != yes; then 27 AC_CHECK_FUNCS_ONCE([strdup])
25 REPLACE_STRDUP=1 28 if test $ac_cv_func_strdup = yes; then
26 AC_LIBOBJ([strdup]) 29 if test $gl_cv_func_malloc_posix != yes; then
30 REPLACE_STRDUP=1
31 AC_LIBOBJ([strdup])
32 gl_PREREQ_STRDUP
33 fi
27 else 34 else
28 AC_REPLACE_FUNCS([strdup]) 35 AC_LIBOBJ([strdup])
36 gl_PREREQ_STRDUP
29 fi 37 fi
30 AC_CHECK_DECLS_ONCE([strdup]) 38 AC_CHECK_DECLS_ONCE([strdup])
31 if test $ac_cv_have_decl_strdup = no; then 39 if test $ac_cv_have_decl_strdup = no; then
32 HAVE_DECL_STRDUP=0 40 HAVE_DECL_STRDUP=0
33 fi 41 fi
34 gl_PREREQ_STRDUP
35]) 42])
36 43
37# Prerequisites of lib/strdup.c. 44# Prerequisites of lib/strdup.c.
diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4
index 8c16ca9..1649b24 100644
--- a/gl/m4/strerror.m4
+++ b/gl/m4/strerror.m4
@@ -1,5 +1,5 @@
1# strerror.m4 serial 9 1# strerror.m4 serial 9
2dnl Copyright (C) 2002, 2007-2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2007-2010 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/string_h.m4 b/gl/m4/string_h.m4
index 2d5553c..cf26123 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, 2008 Free Software Foundation, Inc. 3# Copyright (C) 2007-2010 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 6 8# serial 16
9 9
10# Written by Paul Eggert. 10# Written by Paul Eggert.
11 11
@@ -21,17 +21,29 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY],
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_CHECK_NEXT_HEADERS([string.h])
24
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
27 dnl guaranteed by C89.
28 gl_WARN_ON_USE_PREPARE([[#include <string.h>
29 ]],
30 [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup
31 strncat strndup strnlen strpbrk strsep strcasestr strtok_r strsignal
32 strverscmp])
24]) 33])
25 34
26AC_DEFUN([gl_STRING_MODULE_INDICATOR], 35AC_DEFUN([gl_STRING_MODULE_INDICATOR],
27[ 36[
28 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 37 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
29 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) 38 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
30 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 39 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
40 dnl Define it also as a C macro, for the benefit of the unit tests.
41 gl_MODULE_INDICATOR_FOR_TESTS([$1])
31]) 42])
32 43
33AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], 44AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
34[ 45[
46 GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR])
35 GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM]) 47 GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM])
36 GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY]) 48 GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY])
37 GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR]) 49 GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR])
@@ -40,6 +52,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
40 GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY]) 52 GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY])
41 GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL]) 53 GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL])
42 GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP]) 54 GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP])
55 GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT])
43 GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP]) 56 GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP])
44 GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN]) 57 GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN])
45 GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK]) 58 GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK])
@@ -63,30 +76,36 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
63 GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) 76 GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R])
64 GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) 77 GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR])
65 GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) 78 GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL])
66 GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) 79 GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
80 HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN])
67 dnl Assume proper GNU behavior unless another module says otherwise. 81 dnl Assume proper GNU behavior unless another module says otherwise.
68 HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) 82 HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR])
69 HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) 83 HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
70 HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) 84 HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
71 HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR]) 85 HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR])
72 HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY]) 86 HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR])
73 HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY]) 87 HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY])
74 HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL]) 88 HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY])
75 HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP]) 89 HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL])
76 HAVE_STRNDUP=1; AC_SUBST([HAVE_STRNDUP]) 90 HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP])
77 HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP]) 91 HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP])
78 HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN]) 92 HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN])
79 HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK]) 93 HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK])
80 HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) 94 HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP])
81 HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) 95 HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
82 HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) 96 HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
83 HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR]) 97 HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL])
84 HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) 98 HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP])
85 HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) 99 REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR])
86 REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) 100 REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM])
87 REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) 101 REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY])
88 REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) 102 REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP])
89 REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) 103 REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
90 REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) 104 REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR])
91 REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) 105 REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
106 REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT])
107 REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP])
108 REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
109 REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R])
110 UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R])
92]) 111])
diff --git a/gl/m4/strndup.m4 b/gl/m4/strndup.m4
index 4fa7d5a..810313c 100644
--- a/gl/m4/strndup.m4
+++ b/gl/m4/strndup.m4
@@ -1,5 +1,5 @@
1# strndup.m4 serial 16 1# strndup.m4 serial 17
2dnl Copyright (C) 2002-2003, 2005-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2003, 2005-2010 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,20 @@ AC_DEFUN([gl_FUNC_STRNDUP],
9 dnl Persuade glibc <string.h> to declare strndup(). 9 dnl Persuade glibc <string.h> to declare strndup().
10 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) 10 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
11 11
12 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
12 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) 13 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
13 AC_CHECK_DECLS_ONCE([strndup]) 14 AC_CHECK_DECLS_ONCE([strndup])
15 AC_CHECK_FUNCS_ONCE([strndup])
14 if test $ac_cv_have_decl_strndup = no; then 16 if test $ac_cv_have_decl_strndup = no; then
15 HAVE_DECL_STRNDUP=0 17 HAVE_DECL_STRNDUP=0
16 fi 18 fi
17 19
18 # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. 20 if test $ac_cv_func_strndup = yes; then
19 AC_CACHE_CHECK([for working strndup], [gl_cv_func_strndup], 21 # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'.
20 [AC_RUN_IFELSE([ 22 AC_CACHE_CHECK([for working strndup], [gl_cv_func_strndup_works],
21 AC_LANG_PROGRAM([[#include <string.h> 23 [AC_RUN_IFELSE([
22 #include <stdlib.h>]], [[ 24 AC_LANG_PROGRAM([[#include <string.h>
25 #include <stdlib.h>]], [[
23#ifndef HAVE_DECL_STRNDUP 26#ifndef HAVE_DECL_STRNDUP
24 extern char *strndup (const char *, size_t); 27 extern char *strndup (const char *, size_t);
25#endif 28#endif
@@ -28,26 +31,19 @@ AC_DEFUN([gl_FUNC_STRNDUP],
28 free (s); 31 free (s);
29 s = strndup ("shorter string", 13); 32 s = strndup ("shorter string", 13);
30 return s[13] != '\0';]])], 33 return s[13] != '\0';]])],
31 [gl_cv_func_strndup=yes], 34 [gl_cv_func_strndup_works=yes],
32 [gl_cv_func_strndup=no], 35 [gl_cv_func_strndup_works=no],
33 [AC_CHECK_FUNC([strndup], 36 [case $host_os in
34 [AC_EGREP_CPP([too risky], [ 37 aix*) gl_cv_func_strndup_works="guessing no";;
35#ifdef _AIX 38 *) gl_cv_func_strndup_works="guessing yes";;
36 too risky 39 esac])])
37#endif 40 case $gl_cv_func_strndup_works in
38 ], 41 *no)
39 [gl_cv_func_strndup=no], 42 REPLACE_STRNDUP=1
40 [gl_cv_func_strndup=yes])], 43 AC_LIBOBJ([strndup])
41 [gl_cv_func_strndup=no])])]) 44 ;;
42 if test $gl_cv_func_strndup = yes; then 45 esac
43 AC_DEFINE([HAVE_STRNDUP], [1],
44 [Define if you have the strndup() function and it works.])
45 else 46 else
46 HAVE_STRNDUP=0
47 AC_LIBOBJ([strndup]) 47 AC_LIBOBJ([strndup])
48 gl_PREREQ_STRNDUP
49 fi 48 fi
50]) 49])
51
52# Prerequisites of lib/strndup.c.
53AC_DEFUN([gl_PREREQ_STRNDUP], [:])
diff --git a/gl/m4/strnlen.m4 b/gl/m4/strnlen.m4
index 1c97859..cd48948 100644
--- a/gl/m4/strnlen.m4
+++ b/gl/m4/strnlen.m4
@@ -1,5 +1,6 @@
1# strnlen.m4 serial 10 1# strnlen.m4 serial 10
2dnl Copyright (C) 2002-2003, 2005-2007, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2003, 2005-2007, 2009-2010 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.
diff --git a/gl/m4/strstr.m4 b/gl/m4/strstr.m4
new file mode 100644
index 0000000..779957a
--- /dev/null
+++ b/gl/m4/strstr.m4
@@ -0,0 +1,79 @@
1# strstr.m4 serial 7
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
7dnl Check that strstr works.
8AC_DEFUN([gl_FUNC_STRSTR_SIMPLE],
9[
10 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
11 AC_REQUIRE([gl_FUNC_MEMCHR])
12 if test "$gl_cv_func_memchr_works" != yes; then
13 REPLACE_STRSTR=1
14 AC_LIBOBJ([strstr])
15 fi
16]) # gl_FUNC_STRSTR_SIMPLE
17
18dnl Additionally, check that strstr is efficient.
19AC_DEFUN([gl_FUNC_STRSTR],
20[
21 AC_REQUIRE([gl_FUNC_STRSTR_SIMPLE])
22 if test $REPLACE_STRSTR = 0; then
23 AC_CACHE_CHECK([whether strstr works in linear time],
24 [gl_cv_func_strstr_linear],
25 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
26#include <signal.h> /* for signal */
27#include <string.h> /* for memmem */
28#include <stdlib.h> /* for malloc */
29#include <unistd.h> /* for alarm */
30]], [[size_t m = 1000000;
31 char *haystack = (char *) malloc (2 * m + 2);
32 char *needle = (char *) malloc (m + 2);
33 void *result = 0;
34 /* Failure to compile this test due to missing alarm is okay,
35 since all such platforms (mingw) also have quadratic strstr. */
36 signal (SIGALRM, SIG_DFL);
37 alarm (5);
38 /* Check for quadratic performance. */
39 if (haystack && needle)
40 {
41 memset (haystack, 'A', 2 * m);
42 haystack[2 * m] = 'B';
43 haystack[2 * m + 1] = 0;
44 memset (needle, 'A', m);
45 needle[m] = 'B';
46 needle[m + 1] = 0;
47 result = strstr (haystack, needle);
48 }
49 return !result;]])],
50 [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
52 dnl strstr that works in linear time.
53 AC_EGREP_CPP([Lucky user],
54 [
55#include <features.h>
56#ifdef __GNU_LIBRARY__
57 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 9) || (__GLIBC__ > 2)
58 Lucky user
59 #endif
60#endif
61#ifdef __CYGWIN__
62 #include <cygwin/version.h>
63 #if CYGWIN_VERSION_DLL_MAJOR >= 1007
64 Lucky user
65 #endif
66#endif
67 ],
68 [gl_cv_func_strstr_linear=yes],
69 [gl_cv_func_strstr_linear="guessing no"])
70 ])
71 ])
72 if test "$gl_cv_func_strstr_linear" != yes; then
73 REPLACE_STRSTR=1
74 fi
75 fi
76 if test $REPLACE_STRSTR = 1; then
77 AC_LIBOBJ([strstr])
78 fi
79]) # gl_FUNC_STRSTR
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4
index d1cb9c2..9f4db56 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 12 1# sys_socket_h.m4 serial 17
2dnl Copyright (C) 2005-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2005-2010 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.
@@ -19,7 +19,6 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
19 [gl_cv_header_sys_socket_h_selfcontained=no]) 19 [gl_cv_header_sys_socket_h_selfcontained=no])
20 ]) 20 ])
21 if test $gl_cv_header_sys_socket_h_selfcontained = yes; then 21 if test $gl_cv_header_sys_socket_h_selfcontained = yes; then
22 SYS_SOCKET_H=''
23 dnl If the shutdown function exists, <sys/socket.h> should define 22 dnl If the shutdown function exists, <sys/socket.h> should define
24 dnl SHUT_RD, SHUT_WR, SHUT_RDWR. 23 dnl SHUT_RD, SHUT_WR, SHUT_RDWR.
25 AC_CHECK_FUNCS([shutdown]) 24 AC_CHECK_FUNCS([shutdown])
@@ -37,12 +36,10 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
37 SYS_SOCKET_H='sys/socket.h' 36 SYS_SOCKET_H='sys/socket.h'
38 fi 37 fi
39 fi 38 fi
40 else
41 SYS_SOCKET_H='sys/socket.h'
42 fi 39 fi
43 # We need to check for ws2tcpip.h now. 40 # We need to check for ws2tcpip.h now.
44 gl_PREREQ_SYS_H_SOCKET 41 gl_PREREQ_SYS_H_SOCKET
45 AC_CHECK_TYPES([struct sockaddr_storage],,,[ 42 AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[
46 /* sys/types.h is not needed according to POSIX, but the 43 /* sys/types.h is not needed according to POSIX, but the
47 sys/socket.h in i386-unknown-freebsd4.10 and 44 sys/socket.h in i386-unknown-freebsd4.10 and
48 powerpc-apple-darwin5.5 required it. */ 45 powerpc-apple-darwin5.5 required it. */
@@ -56,12 +53,23 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
56]) 53])
57 if test $ac_cv_type_struct_sockaddr_storage = no; then 54 if test $ac_cv_type_struct_sockaddr_storage = no; then
58 HAVE_STRUCT_SOCKADDR_STORAGE=0 55 HAVE_STRUCT_SOCKADDR_STORAGE=0
59 SYS_SOCKET_H='sys/socket.h'
60 fi 56 fi
61 if test -n "$SYS_SOCKET_H"; then 57 if test $ac_cv_type_sa_family_t = no; then
62 gl_PREREQ_SYS_H_WINSOCK2 58 HAVE_SA_FAMILY_T=0
63 fi 59 fi
64 AC_SUBST([SYS_SOCKET_H]) 60 gl_PREREQ_SYS_H_WINSOCK2
61
62 dnl Check for declarations of anything we want to poison if the
63 dnl corresponding gnulib module is not in use.
64 gl_WARN_ON_USE_PREPARE([[
65/* Some systems require prerequisite headers. */
66#include <sys/types.h>
67#if !defined __GLIBC__ && HAVE_SYS_TIME_H
68# include <sys/time.h>
69#endif
70#include <sys/select.h>
71 ]], [socket connect accept bind getpeername getsockname getsockopt
72 listen recv send recvfrom sendto setsockopt shutdown accept4])
65]) 73])
66 74
67AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], 75AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
@@ -88,7 +96,7 @@ AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
88 AC_SUBST([HAVE_WS2TCPIP_H]) 96 AC_SUBST([HAVE_WS2TCPIP_H])
89]) 97])
90 98
91# Common prerequisites of of the <sys/socket.h> replacement and of the 99# Common prerequisites of the <sys/socket.h> replacement and of the
92# <sys/select.h> replacement. 100# <sys/select.h> replacement.
93# Sets and substitutes HAVE_WINSOCK2_H. 101# Sets and substitutes HAVE_WINSOCK2_H.
94AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], 102AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2],
@@ -117,7 +125,9 @@ AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR],
117[ 125[
118 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 126 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
119 AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) 127 AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
120 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 128 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
129 dnl Define it also as a C macro, for the benefit of the unit tests.
130 gl_MODULE_INDICATOR_FOR_TESTS([$1])
121]) 131])
122 132
123AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], 133AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
@@ -136,5 +146,8 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
136 GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) 146 GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO])
137 GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) 147 GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT])
138 GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) 148 GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN])
149 GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4])
139 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) 150 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
151 HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T])
152 HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4])
140]) 153])
diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4
new file mode 100644
index 0000000..7181c25
--- /dev/null
+++ b/gl/m4/sys_stat_h.m4
@@ -0,0 +1,82 @@
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/threadlib.m4 b/gl/m4/threadlib.m4
index 3dd38aa..05cc4ff 100644
--- a/gl/m4/threadlib.m4
+++ b/gl/m4/threadlib.m4
@@ -1,5 +1,5 @@
1# threadlib.m4 serial 3 (gettext-0.18) 1# threadlib.m4 serial 5 (gettext-0.18)
2dnl Copyright (C) 2005-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2005-2010 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.
@@ -52,13 +52,24 @@ AC_HELP_STRING([--disable-threads], [build without multithread safety]),
52 [if test -n "$gl_use_threads_default"; then 52 [if test -n "$gl_use_threads_default"; then
53 gl_use_threads="$gl_use_threads_default" 53 gl_use_threads="$gl_use_threads_default"
54 else 54 else
55changequote(,)dnl
55 case "$host_os" in 56 case "$host_os" in
56 dnl Disable multithreading by default on OSF/1, because it interferes 57 dnl Disable multithreading by default on OSF/1, because it interferes
57 dnl with fork()/exec(): When msgexec is linked with -lpthread, its 58 dnl with fork()/exec(): When msgexec is linked with -lpthread, its
58 dnl child process gets an endless segmentation fault inside execvp(). 59 dnl child process gets an endless segmentation fault inside execvp().
60 dnl Disable multithreading by default on Cygwin 1.5.x, because it has
61 dnl bugs that lead to endless loops or crashes. See
62 dnl <http://cygwin.com/ml/cygwin/2009-08/msg00283.html>.
59 osf*) gl_use_threads=no ;; 63 osf*) gl_use_threads=no ;;
64 cygwin*)
65 case `uname -r` in
66 1.[0-5].*) gl_use_threads=no ;;
67 *) gl_use_threads=yes ;;
68 esac
69 ;;
60 *) gl_use_threads=yes ;; 70 *) gl_use_threads=yes ;;
61 esac 71 esac
72changequote([,])dnl
62 fi 73 fi
63 ]) 74 ])
64 if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then 75 if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
@@ -96,11 +107,34 @@ AC_DEFUN([gl_THREADLIB_BODY],
96 LTLIBMULTITHREAD= 107 LTLIBMULTITHREAD=
97 if test "$gl_use_threads" != no; then 108 if test "$gl_use_threads" != no; then
98 dnl Check whether the compiler and linker support weak declarations. 109 dnl Check whether the compiler and linker support weak declarations.
99 AC_MSG_CHECKING([whether imported symbols can be declared weak]) 110 AC_CACHE_CHECK([whether imported symbols can be declared weak],
100 gl_have_weak=no 111 [gl_cv_have_weak],
101 AC_TRY_LINK([extern void xyzzy (); 112 [gl_cv_have_weak=no
102#pragma weak xyzzy], [xyzzy();], [gl_have_weak=yes]) 113 dnl First, test whether the compiler accepts it syntactically.
103 AC_MSG_RESULT([$gl_have_weak]) 114 AC_TRY_LINK([extern void xyzzy ();
115#pragma weak xyzzy], [xyzzy();], [gl_cv_have_weak=maybe])
116 if test $gl_cv_have_weak = maybe; then
117 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.
119 AC_TRY_RUN([
120#include <stdio.h>
121#pragma weak fputs
122int main ()
123{
124 return (fputs == NULL);
125}], [gl_cv_have_weak=yes], [gl_cv_have_weak=no],
126 [dnl When cross-compiling, assume that only ELF platforms support
127 dnl weak symbols.
128 AC_EGREP_CPP([Extensible Linking Format],
129 [#ifdef __ELF__
130 Extensible Linking Format
131 #endif
132 ],
133 [gl_cv_have_weak="guessing yes"],
134 [gl_cv_have_weak="guessing no"])
135 ])
136 fi
137 ])
104 if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then 138 if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
105 # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that 139 # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that
106 # it groks <pthread.h>. It's added above, in gl_THREADLIB_EARLY_BODY. 140 # it groks <pthread.h>. It's added above, in gl_THREADLIB_EARLY_BODY.
@@ -154,7 +188,7 @@ AC_DEFUN([gl_THREADLIB_BODY],
154 AC_DEFINE([USE_POSIX_THREADS], [1], 188 AC_DEFINE([USE_POSIX_THREADS], [1],
155 [Define if the POSIX multithreading library can be used.]) 189 [Define if the POSIX multithreading library can be used.])
156 if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then 190 if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then
157 if test $gl_have_weak = yes; then 191 if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then
158 AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], 192 AC_DEFINE([USE_POSIX_THREADS_WEAK], [1],
159 [Define if references to the POSIX multithreading library should be made weak.]) 193 [Define if references to the POSIX multithreading library should be made weak.])
160 LIBTHREAD= 194 LIBTHREAD=
@@ -182,7 +216,7 @@ AC_DEFUN([gl_THREADLIB_BODY],
182 LTLIBMULTITHREAD="$LTLIBTHREAD" 216 LTLIBMULTITHREAD="$LTLIBTHREAD"
183 AC_DEFINE([USE_SOLARIS_THREADS], [1], 217 AC_DEFINE([USE_SOLARIS_THREADS], [1],
184 [Define if the old Solaris multithreading library can be used.]) 218 [Define if the old Solaris multithreading library can be used.])
185 if test $gl_have_weak = yes; then 219 if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then
186 AC_DEFINE([USE_SOLARIS_THREADS_WEAK], [1], 220 AC_DEFINE([USE_SOLARIS_THREADS_WEAK], [1],
187 [Define if references to the old Solaris multithreading library should be made weak.]) 221 [Define if references to the old Solaris multithreading library should be made weak.])
188 LIBTHREAD= 222 LIBTHREAD=
@@ -208,7 +242,7 @@ AC_DEFUN([gl_THREADLIB_BODY],
208 AC_DEFINE([USE_PTH_THREADS], [1], 242 AC_DEFINE([USE_PTH_THREADS], [1],
209 [Define if the GNU Pth multithreading library can be used.]) 243 [Define if the GNU Pth multithreading library can be used.])
210 if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then 244 if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then
211 if test $gl_have_weak = yes; then 245 if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then
212 AC_DEFINE([USE_PTH_THREADS_WEAK], [1], 246 AC_DEFINE([USE_PTH_THREADS_WEAK], [1],
213 [Define if references to the GNU Pth multithreading library should be made weak.]) 247 [Define if references to the GNU Pth multithreading library should be made weak.])
214 LIBTHREAD= 248 LIBTHREAD=
diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4
index d42a635..b88ba94 100644
--- a/gl/m4/time_h.m4
+++ b/gl/m4/time_h.m4
@@ -1,7 +1,6 @@
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, 2004, 2005, 2006, 2007 Free Software 3# Copyright (C) 2000-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc.
4# 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,
@@ -24,17 +23,6 @@ AC_DEFUN([gl_HEADER_TIME_H_BODY],
24 AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) 23 AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
25]) 24])
26 25
27AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
28[
29 dnl If another module says to replace or to not replace, do that.
30 dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
31 dnl this lets maintainers check for portability.
32 REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R])
33 REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP])
34 REPLACE_STRPTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRPTIME])
35 REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM])
36])
37
38dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared 26dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
39dnl in time.h or sys/time.h. 27dnl in time.h or sys/time.h.
40 28
@@ -45,9 +33,9 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
45 [gl_cv_sys_struct_timespec_in_time_h], 33 [gl_cv_sys_struct_timespec_in_time_h],
46 [AC_COMPILE_IFELSE( 34 [AC_COMPILE_IFELSE(
47 [AC_LANG_PROGRAM( 35 [AC_LANG_PROGRAM(
48 [[#include <time.h> 36 [[#include <time.h>
49 ]], 37 ]],
50 [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], 38 [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
51 [gl_cv_sys_struct_timespec_in_time_h=yes], 39 [gl_cv_sys_struct_timespec_in_time_h=yes],
52 [gl_cv_sys_struct_timespec_in_time_h=no])]) 40 [gl_cv_sys_struct_timespec_in_time_h=no])])
53 41
@@ -59,12 +47,12 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
59 AC_CACHE_CHECK([for struct timespec in <sys/time.h>], 47 AC_CACHE_CHECK([for struct timespec in <sys/time.h>],
60 [gl_cv_sys_struct_timespec_in_sys_time_h], 48 [gl_cv_sys_struct_timespec_in_sys_time_h],
61 [AC_COMPILE_IFELSE( 49 [AC_COMPILE_IFELSE(
62 [AC_LANG_PROGRAM( 50 [AC_LANG_PROGRAM(
63 [[#include <sys/time.h> 51 [[#include <sys/time.h>
64 ]], 52 ]],
65 [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], 53 [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
66 [gl_cv_sys_struct_timespec_in_sys_time_h=yes], 54 [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
67 [gl_cv_sys_struct_timespec_in_sys_time_h=no])]) 55 [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
68 if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then 56 if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then
69 SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1 57 SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1
70 fi 58 fi
@@ -72,3 +60,33 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
72 AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC]) 60 AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC])
73 AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC]) 61 AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC])
74]) 62])
63
64AC_DEFUN([gl_TIME_MODULE_INDICATOR],
65[
66 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
67 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
68 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
69 dnl Define it also as a C macro, for the benefit of the unit tests.
70 gl_MODULE_INDICATOR_FOR_TESTS([$1])
71])
72
73AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
74[
75 GNULIB_MKTIME=0; AC_SUBST([GNULIB_MKTIME])
76 GNULIB_NANOSLEEP=0; AC_SUBST([GNULIB_NANOSLEEP])
77 GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME])
78 GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM])
79 GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R])
80 dnl Assume proper GNU behavior unless another module says otherwise.
81 HAVE_LOCALTIME_R=1; AC_SUBST([HAVE_LOCALTIME_R])
82 HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP])
83 HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME])
84 HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM])
85 dnl If another module says to replace or to not replace, do that.
86 dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
87 dnl this lets maintainers check for portability.
88 REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R])
89 REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME])
90 REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP])
91 REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM])
92])
diff --git a/gl/m4/time_r.m4 b/gl/m4/time_r.m4
index c871b56..9e82d39 100644
--- a/gl/m4/time_r.m4
+++ b/gl/m4/time_r.m4
@@ -1,6 +1,6 @@
1dnl Reentrant time functions like localtime_r. 1dnl Reentrant time functions: localtime_r, gmtime_r.
2 2
3dnl Copyright (C) 2003, 2006, 2007, 2008 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2006-2010 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,29 +9,40 @@ dnl Written by Paul Eggert.
9 9
10AC_DEFUN([gl_TIME_R], 10AC_DEFUN([gl_TIME_R],
11[ 11[
12 dnl Persuade glibc and Solaris <time.h> to declare localtime_r. 12 dnl Persuade glibc and Solaris <time.h> to declare localtime_r.
13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
14 14
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 AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature], 18 AC_CHECK_FUNCS_ONCE([localtime_r])
19 [gl_cv_time_r_posix], 19 if test $ac_cv_func_localtime_r = yes; then
20 [AC_TRY_COMPILE( 20 AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature],
21 [#include <time.h>], 21 [gl_cv_time_r_posix],
22 [/* We don't need to append 'restrict's to the argument types, 22 [AC_COMPILE_IFELSE(
23 even though the POSIX signature has the 'restrict's, 23 [AC_LANG_PROGRAM(
24 since C99 says they can't affect type compatibility. */ 24 [[#include <time.h>]],
25 struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r; 25 [[/* We don't need to append 'restrict's to the argument types,
26 if (ptr) return 0; 26 even though the POSIX signature has the 'restrict's,
27 /* Check the return type is a pointer. On HP-UX 10 it is 'int'. */ 27 since C99 says they can't affect type compatibility. */
28 *localtime_r (0, 0);], 28 struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r;
29 [gl_cv_time_r_posix=yes], 29 if (ptr) return 0;
30 [gl_cv_time_r_posix=no])]) 30 /* Check the return type is a pointer.
31 if test $gl_cv_time_r_posix = yes; then 31 On HP-UX 10 it is 'int'. */
32 REPLACE_LOCALTIME_R=0 32 *localtime_r (0, 0);]])
33 ],
34 [gl_cv_time_r_posix=yes],
35 [gl_cv_time_r_posix=no])
36 ])
37 if test $gl_cv_time_r_posix = yes; then
38 REPLACE_LOCALTIME_R=0
39 else
40 REPLACE_LOCALTIME_R=1
41 fi
33 else 42 else
34 REPLACE_LOCALTIME_R=1 43 HAVE_LOCALTIME_R=0
44 fi
45 if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
35 AC_LIBOBJ([time_r]) 46 AC_LIBOBJ([time_r])
36 gl_PREREQ_TIME_R 47 gl_PREREQ_TIME_R
37 fi 48 fi
diff --git a/gl/m4/timegm.m4 b/gl/m4/timegm.m4
index be323c9..bdaafbf 100644
--- a/gl/m4/timegm.m4
+++ b/gl/m4/timegm.m4
@@ -1,5 +1,5 @@
1# timegm.m4 serial 6 1# timegm.m4 serial 8
2dnl Copyright (C) 2003, 2007, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007, 2009, 2010 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,18 +8,18 @@ AC_DEFUN([gl_FUNC_TIMEGM],
8[ 8[
9 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) 9 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
10 AC_REQUIRE([gl_FUNC_MKTIME]) 10 AC_REQUIRE([gl_FUNC_MKTIME])
11 if test $ac_cv_func_working_mktime = no; then 11 REPLACE_TIMEGM=0
12 # Assume that timegm is buggy if mktime is. 12 AC_CHECK_FUNCS_ONCE([timegm])
13 AC_LIBOBJ([timegm])
14 ac_cv_func_timegm=no
15 else
16 AC_REPLACE_FUNCS([timegm])
17 fi
18 REPLACE_TIMEGM=1
19 if test $ac_cv_func_timegm = yes; then 13 if test $ac_cv_func_timegm = yes; then
20 AC_CHECK_DECLS([timegm], [REPLACE_TIMEGM=0], [], [#include <time.h>]) 14 if test $ac_cv_func_working_mktime = no; then
15 # Assume that timegm is buggy if mktime is.
16 REPLACE_TIMEGM=1
17 fi
18 else
19 HAVE_TIMEGM=0
21 fi 20 fi
22 if test $REPLACE_TIMEGM = 1; then 21 if test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1; then
22 AC_LIBOBJ([timegm])
23 gl_PREREQ_TIMEGM 23 gl_PREREQ_TIMEGM
24 fi 24 fi
25]) 25])
@@ -34,7 +34,7 @@ AC_DEFUN([gl_PREREQ_TIMEGM], [
34 # so we need to substitute our own mktime implementation. 34 # so we need to substitute our own mktime implementation.
35 AC_LIBOBJ([mktime]) 35 AC_LIBOBJ([mktime])
36 AC_DEFINE([mktime], [rpl_mktime], 36 AC_DEFINE([mktime], [rpl_mktime],
37 [Define to rpl_mktime if the replacement function should be used.]) 37 [Define to rpl_mktime if the replacement function should be used.])
38 gl_PREREQ_MKTIME]) 38 gl_PREREQ_MKTIME])
39 fi 39 fi
40]) 40])
diff --git a/gl/m4/uintmax_t.m4 b/gl/m4/uintmax_t.m4
index 734b693..03b51bc 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-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2004, 2007-2010 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
index 09adf93..74c3ce6 100644
--- a/gl/m4/unistd-safer.m4
+++ b/gl/m4/unistd-safer.m4
@@ -1,5 +1,5 @@
1#serial 8 1#serial 8
2dnl Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2005-2006, 2009-2010 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_h.m4 b/gl/m4/unistd_h.m4
index ff9a4ea..8c2eec6 100644
--- a/gl/m4/unistd_h.m4
+++ b/gl/m4/unistd_h.m4
@@ -1,5 +1,5 @@
1# unistd_h.m4 serial 17 1# unistd_h.m4 serial 45
2dnl Copyright (C) 2006-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2006-2010 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,7 @@ 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])
14 15
15 gl_CHECK_NEXT_HEADERS([unistd.h]) 16 gl_CHECK_NEXT_HEADERS([unistd.h])
16 17
@@ -21,13 +22,33 @@ AC_DEFUN([gl_UNISTD_H],
21 HAVE_UNISTD_H=0 22 HAVE_UNISTD_H=0
22 fi 23 fi
23 AC_SUBST([HAVE_UNISTD_H]) 24 AC_SUBST([HAVE_UNISTD_H])
25
26 dnl Check for declarations of anything we want to poison if the
27 dnl corresponding gnulib module is not in use.
28 gl_WARN_ON_USE_PREPARE([[#include <unistd.h>
29/* Some systems declare various items in the wrong headers. */
30#ifndef __GLIBC__
31# include <fcntl.h>
32# include <stdio.h>
33# include <stdlib.h>
34# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
35# include <io.h>
36# endif
37#endif
38 ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat
39 fsync ftruncate getcwd getdomainname getdtablesize getgroups
40 gethostname getlogin getlogin_r getpagesize getusershell setusershell
41 endusershell lchown link linkat lseek pipe2 pread readlink readlinkat
42 rmdir sleep symlink symlinkat ttyname_r unlink unlinkat usleep])
24]) 43])
25 44
26AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], 45AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
27[ 46[
28 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 47 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
29 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) 48 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
30 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 49 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
50 dnl Define it also as a C macro, for the benefit of the unit tests.
51 gl_MODULE_INDICATOR_FOR_TESTS([$1])
31]) 52])
32 53
33AC_DEFUN([gl_UNISTD_H_DEFAULTS], 54AC_DEFUN([gl_UNISTD_H_DEFAULTS],
@@ -35,49 +56,99 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
35 GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) 56 GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN])
36 GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) 57 GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE])
37 GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) 58 GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2])
59 GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3])
38 GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) 60 GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON])
39 GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) 61 GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS])
62 GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT])
40 GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) 63 GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR])
64 GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT])
41 GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) 65 GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC])
42 GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) 66 GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE])
43 GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) 67 GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD])
44 GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) 68 GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME])
45 GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) 69 GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE])
70 GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS])
46 GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) 71 GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME])
72 GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN])
47 GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) 73 GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R])
48 GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) 74 GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE])
49 GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) 75 GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL])
50 GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) 76 GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN])
51 GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) 77 GNULIB_LINK=0; AC_SUBST([GNULIB_LINK])
78 GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT])
52 GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) 79 GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK])
80 GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2])
81 GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD])
53 GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) 82 GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK])
83 GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT])
84 GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR])
54 GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) 85 GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP])
86 GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK])
87 GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT])
88 GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R])
89 GNULIB_UNISTD_H_GETOPT=0; AC_SUBST([GNULIB_UNISTD_H_GETOPT])
55 GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) 90 GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
91 GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK])
92 GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT])
93 GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP])
56 GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) 94 GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE])
57 dnl Assume proper GNU behavior unless another module says otherwise. 95 dnl Assume proper GNU behavior unless another module says otherwise.
96 HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN])
58 HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) 97 HAVE_DUP2=1; AC_SUBST([HAVE_DUP2])
98 HAVE_DUP3=1; AC_SUBST([HAVE_DUP3])
59 HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) 99 HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS])
100 HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT])
101 HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR])
102 HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT])
60 HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) 103 HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC])
61 HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) 104 HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE])
62 HAVE_GETDOMAINNAME=1; AC_SUBST([HAVE_GETDOMAINNAME]) 105 HAVE_GETDOMAINNAME=1; AC_SUBST([HAVE_GETDOMAINNAME])
63 HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) 106 HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE])
107 HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS])
64 HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) 108 HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME])
109 HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN])
65 HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) 110 HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE])
66 HAVE_GETUSERSHELL=1; AC_SUBST([HAVE_GETUSERSHELL]) 111 HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN])
67 HAVE_LINK=1; AC_SUBST([HAVE_LINK]) 112 HAVE_LINK=1; AC_SUBST([HAVE_LINK])
113 HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT])
114 HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2])
115 HAVE_PREAD=1; AC_SUBST([HAVE_PREAD])
68 HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) 116 HAVE_READLINK=1; AC_SUBST([HAVE_READLINK])
117 HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT])
69 HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) 118 HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP])
119 HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK])
120 HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT])
121 HAVE_TTYNAME_R=1; AC_SUBST([HAVE_TTYNAME_R])
122 HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT])
123 HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP])
70 HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) 124 HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON])
71 HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) 125 HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
126 HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE])
127 HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL])
72 HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) 128 HAVE_OS_H=0; AC_SUBST([HAVE_OS_H])
73 HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) 129 HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H])
74 REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) 130 REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN])
75 REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) 131 REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE])
76 REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR]) 132 REPLACE_DUP=0; AC_SUBST([REPLACE_DUP])
133 REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2])
134 REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT])
77 REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) 135 REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])
136 REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS])
78 REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) 137 REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
79 REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) 138 REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN])
139 REPLACE_LINK=0; AC_SUBST([REPLACE_LINK])
140 REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT])
80 REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) 141 REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK])
142 REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD])
143 REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK])
144 REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR])
145 REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP])
146 REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK])
147 REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK])
148 REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT])
149 REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP])
81 REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE]) 150 REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE])
82 UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H]) 151 UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
152 UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
153 AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])
83]) 154])
diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4
index 3a1d1e0..50a20cc 100644
--- a/gl/m4/vasnprintf.m4
+++ b/gl/m4/vasnprintf.m4
@@ -1,5 +1,5 @@
1# vasnprintf.m4 serial 29 1# vasnprintf.m4 serial 29
2dnl Copyright (C) 2002-2004, 2006-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2004, 2006-2010 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/vasprintf.m4 b/gl/m4/vasprintf.m4
index 074b03c..b142bc0 100644
--- a/gl/m4/vasprintf.m4
+++ b/gl/m4/vasprintf.m4
@@ -1,5 +1,6 @@
1# vasprintf.m4 serial 6 1# vasprintf.m4 serial 6
2dnl Copyright (C) 2002-2003, 2006-2007 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2003, 2006-2007, 2009-2010 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.
diff --git a/gl/m4/visibility.m4 b/gl/m4/visibility.m4
index 70bca56..6d3f9c9 100644
--- a/gl/m4/visibility.m4
+++ b/gl/m4/visibility.m4
@@ -1,5 +1,5 @@
1# visibility.m4 serial 2 (gettext-0.18) 1# visibility.m4 serial 2 (gettext-0.18)
2dnl Copyright (C) 2005, 2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2005, 2008-2010 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/vsnprintf.m4 b/gl/m4/vsnprintf.m4
index 3b37d46..ed189c2 100644
--- a/gl/m4/vsnprintf.m4
+++ b/gl/m4/vsnprintf.m4
@@ -1,5 +1,5 @@
1# vsnprintf.m4 serial 5 1# vsnprintf.m4 serial 5
2dnl Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2004, 2007-2010 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/warn-on-use.m4 b/gl/m4/warn-on-use.m4
new file mode 100644
index 0000000..42daae8
--- /dev/null
+++ b/gl/m4/warn-on-use.m4
@@ -0,0 +1,45 @@
1# warn-on-use.m4 serial 2
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
7# gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES)
8# ---------------------------------------
9# For each whitespace-separated element in the list of NAMES, define
10# HAVE_RAW_DECL_name if the function has a declaration among INCLUDES
11# even after being undefined as a macro.
12#
13# See warn-on-use.h for some hints on how to poison function names, as
14# well as ideas on poisoning global variables and macros. NAMES may
15# include global variables, but remember that only functions work with
16# _GL_WARN_ON_USE. Typically, INCLUDES only needs to list a single
17# header, but if the replacement header pulls in other headers because
18# some systems declare functions in the wrong header, then INCLUDES
19# should do likewise.
20#
21# If you assume C89, then it is generally safe to assume declarations
22# for functions declared in that standard (such as gets) without
23# needing gl_WARN_ON_USE_PREPARE.
24AC_DEFUN([gl_WARN_ON_USE_PREPARE],
25[
26 m4_foreach_w([gl_decl], [$2],
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
29 undefining macros.])])dnl
30 for gl_func in m4_flatten([$2]); do
31 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],
33 gl_Symbol,
34 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1],
35[@%:@undef $gl_func
36 (void) $gl_func;])],
37 [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])])
38 AS_VAR_IF(gl_Symbol, [yes],
39 [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1])
40 dnl shortcut - if the raw declaration exists, then set a cache
41 dnl variable to allow skipping any later AC_CHECK_DECL efforts
42 eval ac_cv_have_decl_$gl_func=yes])
43 AS_VAR_POPDEF([gl_Symbol])dnl
44 done
45])
diff --git a/gl/m4/wchar.m4 b/gl/m4/wchar_h.m4
index 2e52a82..8cae82d 100644
--- a/gl/m4/wchar.m4
+++ b/gl/m4/wchar_h.m4
@@ -1,23 +1,30 @@
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-2009 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2010 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.m4 serial 23 10# wchar_h.m4 serial 33
11 11
12AC_DEFUN([gl_WCHAR_H], 12AC_DEFUN([gl_WCHAR_H],
13[ 13[
14 AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) 14 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
15 AC_CACHE_CHECK([whether <wchar.h> is standalone], 15 AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
16 [gl_cv_header_wchar_h_standalone], 16 dnl Prepare for creating substitute <wchar.h>.
17 [AC_COMPILE_IFELSE([[#include <wchar.h> 17 dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
18wchar_t w;]], 18 dnl character support).
19 [gl_cv_header_wchar_h_standalone=yes], 19 dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK.
20 [gl_cv_header_wchar_h_standalone=no])]) 20 AC_CHECK_HEADERS_ONCE([wchar.h])
21 gl_CHECK_NEXT_HEADERS([wchar.h])
22 if test $ac_cv_header_wchar_h = yes; then
23 HAVE_WCHAR_H=1
24 else
25 HAVE_WCHAR_H=0
26 fi
27 AC_SUBST([HAVE_WCHAR_H])
21 28
22 AC_REQUIRE([gt_TYPE_WINT_T]) 29 AC_REQUIRE([gt_TYPE_WINT_T])
23 if test $gt_cv_c_wint_t = yes; then 30 if test $gt_cv_c_wint_t = yes; then
@@ -27,36 +34,82 @@ wchar_t w;]],
27 fi 34 fi
28 AC_SUBST([HAVE_WINT_T]) 35 AC_SUBST([HAVE_WINT_T])
29 36
30 if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes; then 37 dnl Check for declarations of anything we want to poison if the
31 WCHAR_H=wchar.h 38 dnl corresponding gnulib module is not in use.
32 fi 39 gl_WARN_ON_USE_PREPARE([[
40/* Some systems require additional headers. */
41#ifndef __GLIBC__
42# include <stddef.h>
43# include <stdio.h>
44# include <time.h>
45#endif
46#include <wchar.h>
47 ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb
48 wcsrtombs wcsnrtombs wcwidth])
49])
33 50
34 dnl Prepare for creating substitute <wchar.h>. 51dnl Check whether <wchar.h> is usable at all.
35 dnl Do it always: WCHAR_H may be empty here but can be set later. 52AC_DEFUN([gl_WCHAR_H_INLINE_OK],
36 dnl Check for <wchar.h> (missing in Linux uClibc when built without wide 53[
37 dnl character support). 54 dnl Test whether <wchar.h> suffers due to the transition from '__inline' to
38 AC_CHECK_HEADERS_ONCE([wchar.h]) 55 dnl 'gnu_inline'. See <http://sourceware.org/bugzilla/show_bug.cgi?id=4022>
39 if test $ac_cv_header_wchar_h = yes; then 56 dnl and <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary,
40 HAVE_WCHAR_H=1 57 dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and
41 else 58 dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>.
42 HAVE_WCHAR_H=0 59 AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly],
60 [gl_cv_header_wchar_h_correct_inline],
61 [gl_cv_header_wchar_h_correct_inline=yes
62 AC_LANG_CONFTEST([
63 AC_LANG_SOURCE([[#define wcstod renamed_wcstod
64#include <wchar.h>
65extern int zero (void);
66int main () { return zero(); }
67]])])
68 if AC_TRY_EVAL([ac_compile]); then
69 mv conftest.$ac_objext conftest1.$ac_objext
70 AC_LANG_CONFTEST([
71 AC_LANG_SOURCE([[#define wcstod renamed_wcstod
72#include <wchar.h>
73int zero (void) { return 0; }
74]])])
75 if AC_TRY_EVAL([ac_compile]); then
76 mv conftest.$ac_objext conftest2.$ac_objext
77 if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then
78 :
79 else
80 gl_cv_header_wchar_h_correct_inline=no
81 fi
82 fi
83 fi
84 rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext
85 ])
86 if test $gl_cv_header_wchar_h_correct_inline = no; then
87 AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS).
88This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in
89C99 mode. You have four options:
90 - Add the flag -fgnu89-inline to CC and reconfigure, or
91 - Fix your include files, using parts of
92 <http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or
93 - Use a gcc version older than 4.3, or
94 - Don't use the flags -std=c99 or -std=gnu99.
95Configuration aborted.])
43 fi 96 fi
44 AC_SUBST([HAVE_WCHAR_H])
45 gl_CHECK_NEXT_HEADERS([wchar.h])
46]) 97])
47 98
48dnl Unconditionally enables the replacement of <wchar.h>. 99dnl Unconditionally enables the replacement of <wchar.h>.
49AC_DEFUN([gl_REPLACE_WCHAR_H], 100AC_DEFUN([gl_REPLACE_WCHAR_H],
50[ 101[
51 AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) 102 dnl This is a no-op, because <wchar.h> is always overridden.
52 WCHAR_H=wchar.h 103 :
53]) 104])
54 105
55AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], 106AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
56[ 107[
57 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 108 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
58 AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) 109 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
59 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 110 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
111 dnl Define it also as a C macro, for the benefit of the unit tests.
112 gl_MODULE_INDICATOR_FOR_TESTS([$1])
60]) 113])
61 114
62AC_DEFUN([gl_WCHAR_H_DEFAULTS], 115AC_DEFUN([gl_WCHAR_H_DEFAULTS],
@@ -96,5 +149,4 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
96 REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS]) 149 REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS])
97 REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS]) 150 REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS])
98 REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) 151 REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
99 WCHAR_H=''; AC_SUBST([WCHAR_H])
100]) 152])
diff --git a/gl/m4/wchar_t.m4 b/gl/m4/wchar_t.m4
index fb27a7f..ed804e6 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 3 (gettext-0.18)
2dnl Copyright (C) 2002-2003, 2008, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2003, 2008-2010 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/wcrtomb.m4 b/gl/m4/wcrtomb.m4
index cb7d926..6a2d772 100644
--- a/gl/m4/wcrtomb.m4
+++ b/gl/m4/wcrtomb.m4
@@ -1,5 +1,5 @@
1# wcrtomb.m4 serial 4 1# wcrtomb.m4 serial 5
2dnl Copyright (C) 2008-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2008-2010 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,37 +10,37 @@ AC_DEFUN([gl_FUNC_WCRTOMB],
10 10
11 AC_REQUIRE([AC_TYPE_MBSTATE_T]) 11 AC_REQUIRE([AC_TYPE_MBSTATE_T])
12 gl_MBSTATE_T_BROKEN 12 gl_MBSTATE_T_BROKEN
13 if test $REPLACE_MBSTATE_T = 1; then 13
14 REPLACE_WCRTOMB=1
15 fi
16 AC_CHECK_FUNCS_ONCE([wcrtomb]) 14 AC_CHECK_FUNCS_ONCE([wcrtomb])
17 if test $ac_cv_func_wcrtomb = no; then 15 if test $ac_cv_func_wcrtomb = no; then
18 HAVE_WCRTOMB=0 16 HAVE_WCRTOMB=0
19 fi 17 else
20 if test $HAVE_WCRTOMB != 0 && test $REPLACE_WCRTOMB != 1; then 18 if test $REPLACE_MBSTATE_T = 1; then
21 dnl On AIX 4.3, OSF/1 5.1 and Solaris 10, wcrtomb (NULL, 0, NULL) sometimes 19 REPLACE_WCRTOMB=1
22 dnl returns 0 instead of 1. 20 else
23 AC_REQUIRE([AC_PROG_CC]) 21 dnl On AIX 4.3, OSF/1 5.1 and Solaris 10, wcrtomb (NULL, 0, NULL) sometimes
24 AC_REQUIRE([gt_LOCALE_FR]) 22 dnl returns 0 instead of 1.
25 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 23 AC_REQUIRE([AC_PROG_CC])
26 AC_REQUIRE([gt_LOCALE_JA]) 24 AC_REQUIRE([gt_LOCALE_FR])
27 AC_REQUIRE([gt_LOCALE_ZH_CN]) 25 AC_REQUIRE([gt_LOCALE_FR_UTF8])
28 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 26 AC_REQUIRE([gt_LOCALE_JA])
29 AC_CACHE_CHECK([whether wcrtomb return value is correct], 27 AC_REQUIRE([gt_LOCALE_ZH_CN])
30 [gl_cv_func_wcrtomb_retval], 28 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
31 [ 29 AC_CACHE_CHECK([whether wcrtomb return value is correct],
32 dnl Initial guess, used when cross-compiling or when no suitable locale 30 [gl_cv_func_wcrtomb_retval],
33 dnl is present. 31 [
32 dnl Initial guess, used when cross-compiling or when no suitable locale
33 dnl is present.
34changequote(,)dnl 34changequote(,)dnl
35 case "$host_os" in 35 case "$host_os" in
36 # Guess no on AIX 4, OSF/1 and Solaris. 36 # Guess no on AIX 4, OSF/1 and Solaris.
37 aix4* | osf* | solaris*) gl_cv_func_wcrtomb_retval="guessing no" ;; 37 aix4* | osf* | solaris*) gl_cv_func_wcrtomb_retval="guessing no" ;;
38 # Guess yes otherwise. 38 # Guess yes otherwise.
39 *) gl_cv_func_wcrtomb_retval="guessing yes" ;; 39 *) gl_cv_func_wcrtomb_retval="guessing yes" ;;
40 esac 40 esac
41changequote([,])dnl 41changequote([,])dnl
42 if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then 42 if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then
43 AC_TRY_RUN([ 43 AC_TRY_RUN([
44#include <locale.h> 44#include <locale.h>
45#include <stdio.h> 45#include <stdio.h>
46#include <string.h> 46#include <string.h>
@@ -69,15 +69,16 @@ int main ()
69 } 69 }
70 return 0; 70 return 0;
71}], 71}],
72 [gl_cv_func_wcrtomb_retval=yes], 72 [gl_cv_func_wcrtomb_retval=yes],
73 [gl_cv_func_wcrtomb_retval=no], 73 [gl_cv_func_wcrtomb_retval=no],
74 [:]) 74 [:])
75 fi 75 fi
76 ]) 76 ])
77 case "$gl_cv_func_wcrtomb_retval" in 77 case "$gl_cv_func_wcrtomb_retval" in
78 *yes) ;; 78 *yes) ;;
79 *) REPLACE_WCRTOMB=1 ;; 79 *) REPLACE_WCRTOMB=1 ;;
80 esac 80 esac
81 fi
81 fi 82 fi
82 if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then 83 if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then
83 gl_REPLACE_WCHAR_H 84 gl_REPLACE_WCHAR_H
diff --git a/gl/m4/wctype.m4 b/gl/m4/wctype_h.m4
index 6a1b6f0..3292451 100644
--- a/gl/m4/wctype.m4
+++ b/gl/m4/wctype_h.m4
@@ -1,8 +1,8 @@
1# wctype.m4 serial 2 1# wctype_h.m4 serial 6
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-2008 Free Software Foundation, Inc. 5dnl Copyright (C) 2006-2010 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.
@@ -12,6 +12,7 @@ dnl Written by Paul Eggert.
12AC_DEFUN([gl_WCTYPE_H], 12AC_DEFUN([gl_WCTYPE_H],
13[ 13[
14 AC_REQUIRE([AC_PROG_CC]) 14 AC_REQUIRE([AC_PROG_CC])
15 AC_REQUIRE([AC_CANONICAL_HOST])
15 AC_CHECK_FUNCS_ONCE([iswcntrl]) 16 AC_CHECK_FUNCS_ONCE([iswcntrl])
16 if test $ac_cv_func_iswcntrl = yes; then 17 if test $ac_cv_func_iswcntrl = yes; then
17 HAVE_ISWCNTRL=1 18 HAVE_ISWCNTRL=1
@@ -19,6 +20,13 @@ AC_DEFUN([gl_WCTYPE_H],
19 HAVE_ISWCNTRL=0 20 HAVE_ISWCNTRL=0
20 fi 21 fi
21 AC_SUBST([HAVE_ISWCNTRL]) 22 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])
22 AC_CHECK_HEADERS_ONCE([wctype.h]) 30 AC_CHECK_HEADERS_ONCE([wctype.h])
23 AC_REQUIRE([AC_C_INLINE]) 31 AC_REQUIRE([AC_C_INLINE])
24 32
@@ -30,40 +38,34 @@ AC_DEFUN([gl_WCTYPE_H],
30 fi 38 fi
31 AC_SUBST([HAVE_WINT_T]) 39 AC_SUBST([HAVE_WINT_T])
32 40
33 WCTYPE_H=wctype.h
34 if test $ac_cv_header_wctype_h = yes; then 41 if test $ac_cv_header_wctype_h = yes; then
35 if test $ac_cv_func_iswcntrl = yes; then 42 if test $ac_cv_func_iswcntrl = yes; then
36 dnl Linux libc5 has an iswprint function that returns 0 for all arguments. 43 dnl Linux libc5 has an iswprint function that returns 0 for all arguments.
37 dnl The other functions are likely broken in the same way. 44 dnl The other functions are likely broken in the same way.
38 AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works], 45 AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works],
39 [ 46 [
40 AC_TRY_RUN([#include <stddef.h> 47 AC_RUN_IFELSE([AC_LANG_SOURCE([[
41 #include <stdio.h> 48 #include <stddef.h>
42 #include <time.h> 49 #include <stdio.h>
43 #include <wchar.h> 50 #include <time.h>
44 #include <wctype.h> 51 #include <wchar.h>
45 int main () { return iswprint ('x') == 0; }], 52 #include <wctype.h>
53 int main () { return iswprint ('x') == 0; }]])],
46 [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no], 54 [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no],
47 [AC_TRY_COMPILE([#include <stdlib.h> 55 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
48 #if __GNU_LIBRARY__ == 1 56 #if __GNU_LIBRARY__ == 1
49 Linux libc5 i18n is broken. 57 Linux libc5 i18n is broken.
50 #endif], [], 58 #endif]], [])],
51 [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no]) 59 [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no])
52 ]) 60 ])
53 ]) 61 ])
54 if test $gl_cv_func_iswcntrl_works = yes; then
55 WCTYPE_H=
56 fi
57 fi 62 fi
58 dnl Compute NEXT_WCTYPE_H even if WCTYPE_H is empty,
59 dnl for the benefit of builds from non-distclean directories.
60 gl_CHECK_NEXT_HEADERS([wctype.h]) 63 gl_CHECK_NEXT_HEADERS([wctype.h])
61 HAVE_WCTYPE_H=1 64 HAVE_WCTYPE_H=1
62 else 65 else
63 HAVE_WCTYPE_H=0 66 HAVE_WCTYPE_H=0
64 fi 67 fi
65 AC_SUBST([HAVE_WCTYPE_H]) 68 AC_SUBST([HAVE_WCTYPE_H])
66 AC_SUBST([WCTYPE_H])
67 69
68 if test "$gl_cv_func_iswcntrl_works" = no; then 70 if test "$gl_cv_func_iswcntrl_works" = no; then
69 REPLACE_ISWCNTRL=1 71 REPLACE_ISWCNTRL=1
diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4
index 47a4363..a6c7d15 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 4 (gettext-0.18)
2dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007-2010 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/write.m4 b/gl/m4/write.m4
index 812b19b..56325ab 100644
--- a/gl/m4/write.m4
+++ b/gl/m4/write.m4
@@ -1,5 +1,5 @@
1# write.m4 serial 1 1# write.m4 serial 1
2dnl Copyright (C) 2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2008, 2009, 2010 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/xalloc.m4 b/gl/m4/xalloc.m4
index 837a948..83247fe 100644
--- a/gl/m4/xalloc.m4
+++ b/gl/m4/xalloc.m4
@@ -1,5 +1,6 @@
1# xalloc.m4 serial 16 1# xalloc.m4 serial 16
2dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2009, 2010 Free Software
3dnl Foundation, 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.
diff --git a/gl/m4/xsize.m4 b/gl/m4/xsize.m4
index 631893c..b653693 100644
--- a/gl/m4/xsize.m4
+++ b/gl/m4/xsize.m4
@@ -1,5 +1,5 @@
1# xsize.m4 serial 4 1# xsize.m4 serial 4
2dnl Copyright (C) 2003-2004, 2008 Free Software Foundation, Inc. 2dnl Copyright (C) 2003-2004, 2008-2010 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/xstrndup.m4 b/gl/m4/xstrndup.m4
index 8a30ab1..74302cc 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 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2009, 2010 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.