summaryrefslogtreecommitdiffstats
path: root/gl/m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4')
-rw-r--r--gl/m4/absolute-header.m411
-rw-r--r--gl/m4/alloca.m48
-rw-r--r--gl/m4/extensions.m452
-rw-r--r--gl/m4/float_h.m419
-rw-r--r--gl/m4/fsusage.m410
-rw-r--r--gl/m4/getaddrinfo.m458
-rw-r--r--gl/m4/getloadavg.m44
-rw-r--r--gl/m4/gettext.m442
-rw-r--r--gl/m4/gnulib-cache.m44
-rw-r--r--gl/m4/gnulib-common.m445
-rw-r--r--gl/m4/gnulib-comp.m4213
-rw-r--r--gl/m4/iconv.m487
-rw-r--r--gl/m4/include_next.m4107
-rw-r--r--gl/m4/intdiv0.m446
-rw-r--r--gl/m4/intl.m436
-rw-r--r--gl/m4/intlmacosx.m451
-rw-r--r--gl/m4/intmax_t.m412
-rw-r--r--gl/m4/lib-link.m42
-rw-r--r--gl/m4/localcharset.m416
-rw-r--r--gl/m4/lock.m411
-rw-r--r--gl/m4/longdouble.m431
-rw-r--r--gl/m4/longlong.m478
-rw-r--r--gl/m4/malloc.m441
-rw-r--r--gl/m4/mbchar.m414
-rw-r--r--gl/m4/mbiter.m417
-rw-r--r--gl/m4/mbrtowc.m431
-rw-r--r--gl/m4/memchr.m418
-rw-r--r--gl/m4/minmax.m441
-rw-r--r--gl/m4/netinet_in_h.m426
-rw-r--r--gl/m4/po.m425
-rw-r--r--gl/m4/printf-posix.m46
-rw-r--r--gl/m4/regex.m480
-rw-r--r--gl/m4/snprintf.m424
-rw-r--r--gl/m4/socklen.m48
-rw-r--r--gl/m4/stdint.m470
-rw-r--r--gl/m4/stdio_h.m485
-rw-r--r--gl/m4/stdlib_h.m442
-rw-r--r--gl/m4/strcase.m439
-rw-r--r--gl/m4/strdup.m411
-rw-r--r--gl/m4/strerror.m447
-rw-r--r--gl/m4/string_h.m487
-rw-r--r--gl/m4/strndup.m413
-rw-r--r--gl/m4/strnlen.m418
-rw-r--r--gl/m4/sys_socket_h.m448
-rw-r--r--gl/m4/uintmax_t.m48
-rw-r--r--gl/m4/ulonglong.m448
-rw-r--r--gl/m4/unistd_h.m471
-rw-r--r--gl/m4/vasnprintf.m4232
-rw-r--r--gl/m4/vasprintf.m430
-rw-r--r--gl/m4/vsnprintf.m424
-rw-r--r--gl/m4/wchar.m439
-rw-r--r--gl/m4/wctype.m415
-rw-r--r--gl/m4/wcwidth.m430
-rw-r--r--gl/m4/wint_t.m42
54 files changed, 1612 insertions, 621 deletions
diff --git a/gl/m4/absolute-header.m4 b/gl/m4/absolute-header.m4
index c649df08..5b7a2fc3 100644
--- a/gl/m4/absolute-header.m4
+++ b/gl/m4/absolute-header.m4
@@ -1,5 +1,5 @@
1# absolute-header.m4 serial 6 1# absolute-header.m4 serial 7
2dnl Copyright (C) 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2006, 2007 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.
@@ -32,7 +32,12 @@ dnl eval is necessary to expand ac_cpp.
32dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell. 32dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
33 AS_VAR_SET(gl_absolute_header, 33 AS_VAR_SET(gl_absolute_header,
34[`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | 34[`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
35sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#;s#^/[^/]#//&#;p;q;}'`]) 35sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{
36 s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#
37 s#^/[^/]#//&#
38 p
39 q
40}'`])
36 fi 41 fi
37 AS_VAR_POPDEF([ac_header_exists])dnl 42 AS_VAR_POPDEF([ac_header_exists])dnl
38 ])dnl 43 ])dnl
diff --git a/gl/m4/alloca.m4 b/gl/m4/alloca.m4
index eb62e0e7..95f54a6d 100644
--- a/gl/m4/alloca.m4
+++ b/gl/m4/alloca.m4
@@ -1,5 +1,5 @@
1# alloca.m4 serial 7 1# alloca.m4 serial 8
2dnl Copyright (C) 2002-2004, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2004, 2006, 2007 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.
@@ -39,10 +39,6 @@ AC_DEFUN([gl_FUNC_ALLOCA],
39 ALLOCA_H=alloca.h 39 ALLOCA_H=alloca.h
40 fi 40 fi
41 AC_SUBST([ALLOCA_H]) 41 AC_SUBST([ALLOCA_H])
42
43 AC_DEFINE(HAVE_ALLOCA_H, 1,
44 [Define HAVE_ALLOCA_H for backward compatibility with older code
45 that includes <alloca.h> only if HAVE_ALLOCA_H is defined.])
46]) 42])
47 43
48# Prerequisites of lib/alloca.c. 44# Prerequisites of lib/alloca.c.
diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4
index 143a9e54..bcbb3cee 100644
--- a/gl/m4/extensions.m4
+++ b/gl/m4/extensions.m4
@@ -1,14 +1,14 @@
1# serial 4 -*- Autoconf -*- 1# serial 5 -*- 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 Free Software Foundation, Inc. 4# Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation 5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it, 6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved. 7# with or without modifications, as long as this notice is preserved.
8 8
9# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS 9# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
10# Autoconf. Perhaps we can remove this once we can assume Autoconf 10# Autoconf. Perhaps we can remove this once we can assume Autoconf
11# 2.61 or later everywhere, but since CVS Autoconf mutates rapidly 11# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly
12# enough in this area it's likely we'll need to redefine 12# enough in this area it's likely we'll need to redefine
13# AC_USE_SYSTEM_EXTENSIONS for quite some time. 13# AC_USE_SYSTEM_EXTENSIONS for quite some time.
14 14
@@ -16,26 +16,48 @@
16# ------------------------ 16# ------------------------
17# Enable extensions on systems that normally disable them, 17# Enable extensions on systems that normally disable them,
18# typically due to standards-conformance issues. 18# typically due to standards-conformance issues.
19# Remember that #undef in AH_VERBATIM gets replaced with #define by
20# AC_DEFINE. The goal here is to define all known feature-enabling
21# macros, then, if reports of conflicts are made, disable macros that
22# cause problems on some platforms (such as __EXTENSIONS__).
19AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], 23AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
20[ 24[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
21 AC_BEFORE([$0], [AC_COMPILE_IFELSE]) 25AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
22 AC_BEFORE([$0], [AC_RUN_IFELSE])
23 26
24 AC_REQUIRE([AC_GNU_SOURCE]) 27 AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
25 AC_REQUIRE([AC_AIX]) 28 if test "$MINIX" = yes; then
26 AC_REQUIRE([AC_MINIX]) 29 AC_DEFINE([_POSIX_SOURCE], [1],
30 [Define to 1 if you need to in order for `stat' and other
31 things to work.])
32 AC_DEFINE([_POSIX_1_SOURCE], [2],
33 [Define to 2 if the system does not provide POSIX.1 features
34 except with this defined.])
35 AC_DEFINE([_MINIX], [1],
36 [Define to 1 if on MINIX.])
37 fi
27 38
28 AH_VERBATIM([__EXTENSIONS__], 39 AH_VERBATIM([__EXTENSIONS__],
29[/* Enable extensions on Solaris. */ 40[/* Enable extensions on AIX 3, Interix. */
30#ifndef __EXTENSIONS__ 41#ifndef _ALL_SOURCE
31# undef __EXTENSIONS__ 42# undef _ALL_SOURCE
43#endif
44/* Enable GNU extensions on systems that have them. */
45#ifndef _GNU_SOURCE
46# undef _GNU_SOURCE
32#endif 47#endif
48/* Enable threading extensions on Solaris. */
33#ifndef _POSIX_PTHREAD_SEMANTICS 49#ifndef _POSIX_PTHREAD_SEMANTICS
34# undef _POSIX_PTHREAD_SEMANTICS 50# undef _POSIX_PTHREAD_SEMANTICS
35#endif 51#endif
52/* Enable extensions on HP NonStop. */
36#ifndef _TANDEM_SOURCE 53#ifndef _TANDEM_SOURCE
37# undef _TANDEM_SOURCE 54# undef _TANDEM_SOURCE
38#endif]) 55#endif
56/* Enable general extensions on Solaris. */
57#ifndef __EXTENSIONS__
58# undef __EXTENSIONS__
59#endif
60])
39 AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], 61 AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
40 [ac_cv_safe_to_define___extensions__], 62 [ac_cv_safe_to_define___extensions__],
41 [AC_COMPILE_IFELSE( 63 [AC_COMPILE_IFELSE(
@@ -46,9 +68,11 @@ AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
46 [ac_cv_safe_to_define___extensions__=no])]) 68 [ac_cv_safe_to_define___extensions__=no])])
47 test $ac_cv_safe_to_define___extensions__ = yes && 69 test $ac_cv_safe_to_define___extensions__ = yes &&
48 AC_DEFINE([__EXTENSIONS__]) 70 AC_DEFINE([__EXTENSIONS__])
71 AC_DEFINE([_ALL_SOURCE])
72 AC_DEFINE([_GNU_SOURCE])
49 AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) 73 AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
50 AC_DEFINE([_TANDEM_SOURCE]) 74 AC_DEFINE([_TANDEM_SOURCE])
51]) 75])# AC_USE_SYSTEM_EXTENSIONS
52 76
53# gl_USE_SYSTEM_EXTENSIONS 77# gl_USE_SYSTEM_EXTENSIONS
54# ------------------------ 78# ------------------------
diff --git a/gl/m4/float_h.m4 b/gl/m4/float_h.m4
new file mode 100644
index 00000000..d36e3a46
--- /dev/null
+++ b/gl/m4/float_h.m4
@@ -0,0 +1,19 @@
1# float_h.m4 serial 3
2dnl Copyright (C) 2007 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_FLOAT_H],
8[
9 AC_REQUIRE([AC_PROG_CC])
10 AC_REQUIRE([AC_CANONICAL_HOST])
11 FLOAT_H=
12 case "$host_os" in
13 beos* | openbsd*)
14 FLOAT_H=float.h
15 gl_CHECK_NEXT_HEADERS([float.h])
16 ;;
17 esac
18 AC_SUBST([FLOAT_H])
19])
diff --git a/gl/m4/fsusage.m4 b/gl/m4/fsusage.m4
index 08bf06c9..18eedbca 100644
--- a/gl/m4/fsusage.m4
+++ b/gl/m4/fsusage.m4
@@ -1,8 +1,7 @@
1#serial 22 1#serial 23
2# Obtaining file system usage information. 2# Obtaining file system usage information.
3 3
4# Copyright (C) 1997, 1998, 2000, 2001, 2003, 2004, 2005, 2006 Free Software 4# Copyright (C) 1997, 1998, 2000, 2001, 2003-2007 Free Software Foundation, Inc.
5# Foundation, Inc.
6# 5#
7# This file is free software; the Free Software Foundation 6# This file is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it, 7# gives unlimited permission to copy and/or distribute it,
@@ -55,6 +54,11 @@ one of the corresponding file systems is hard-mounted, but not available.
55statvfs in GNU libc on BeOS operates differently: it only makes a system 54statvfs in GNU libc on BeOS operates differently: it only makes a system
56call. 55call.
57#endif 56#endif
57
58#ifdef __osf__
59"Do not use Tru64's statvfs implementation"
60#endif
61
58#include <sys/statvfs.h>], 62#include <sys/statvfs.h>],
59 [struct statvfs fsd; statvfs (0, &fsd);], 63 [struct statvfs fsd; statvfs (0, &fsd);],
60 fu_cv_sys_stat_statvfs=yes, 64 fu_cv_sys_stat_statvfs=yes,
diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4
index db285d94..5d36c195 100644
--- a/gl/m4/getaddrinfo.m4
+++ b/gl/m4/getaddrinfo.m4
@@ -1,15 +1,31 @@
1# getaddrinfo.m4 serial 11 1# getaddrinfo.m4 serial 15
2dnl Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2004, 2005, 2006, 2007 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_GETADDRINFO], 7AC_DEFUN([gl_GETADDRINFO],
8[ 8[
9 AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
9 AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo]) 10 AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo])
10 11
12 AC_CHECK_HEADERS_ONCE(netdb.h)
13
11 AC_SEARCH_LIBS(getaddrinfo, [nsl socket]) 14 AC_SEARCH_LIBS(getaddrinfo, [nsl socket])
12 AC_CHECK_FUNCS(getaddrinfo,, [ 15 AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
16 AC_TRY_LINK([
17#include <sys/types.h>
18#ifdef HAVE_SYS_SOCKET_H
19#include <sys/socket.h>
20#endif
21#ifdef HAVE_NETDB_H
22#include <netdb.h>
23#endif
24#include <stddef.h>
25], [getaddrinfo("", "", NULL, NULL);],
26 [gl_cv_func_getaddrinfo=yes],
27 [gl_cv_func_getaddrinfo=no])])
28 if test $gl_cv_func_getaddrinfo = no; then
13 AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32, 29 AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32,
14 gl_cv_w32_getaddrinfo, [ 30 gl_cv_w32_getaddrinfo, [
15 gl_cv_w32_getaddrinfo=no 31 gl_cv_w32_getaddrinfo=no
@@ -19,21 +35,46 @@ AC_DEFUN([gl_GETADDRINFO],
19#ifdef HAVE_WS2TCPIP_H 35#ifdef HAVE_WS2TCPIP_H
20#include <ws2tcpip.h> 36#include <ws2tcpip.h>
21#endif 37#endif
22], [getaddrinfo(0, 0, 0, 0);], gl_cv_w32_getaddrinfo=yes) 38#include <stddef.h>
39], [getaddrinfo(NULL, NULL, NULL, NULL);], gl_cv_w32_getaddrinfo=yes)
23 LIBS="$am_save_LIBS"]) 40 LIBS="$am_save_LIBS"])
24 if test "$gl_cv_w32_getaddrinfo" = "yes"; then 41 if test "$gl_cv_w32_getaddrinfo" = "yes"; then
25 LIBS="$LIBS -lws2_32" 42 LIBS="$LIBS -lws2_32"
26 else 43 else
27 AC_LIBOBJ(getaddrinfo) 44 AC_LIBOBJ(getaddrinfo)
28 fi 45 fi
29 ]) 46 fi
47
48 # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an
49 # inline function declared in ws2tcpip.h, so we need to get that
50 # header included somehow.
51 AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)],
52 gl_cv_func_gai_strerror, [
53 AC_TRY_LINK([
54#include <sys/types.h>
55#ifdef HAVE_SYS_SOCKET_H
56#include <sys/socket.h>
57#endif
58#ifdef HAVE_NETDB_H
59#include <netdb.h>
60#endif
61#ifdef HAVE_WS2TCPIP_H
62#include <ws2tcpip.h>
63#endif
64#include <stddef.h>
65], [gai_strerror (NULL);],
66 [gl_cv_func_gai_strerror=yes],
67 [gl_cv_func_gai_strerror=no])])
68 if test $gl_cv_func_gai_strerror = no; then
69 AC_LIBOBJ(gai_strerror)
70 fi
30 71
31 AC_REPLACE_FUNCS(gai_strerror)
32 gl_PREREQ_GETADDRINFO 72 gl_PREREQ_GETADDRINFO
33]) 73])
34 74
35# Prerequisites of lib/getaddrinfo.h and lib/getaddrinfo.c. 75# Prerequisites of lib/getaddrinfo.h and lib/getaddrinfo.c.
36AC_DEFUN([gl_PREREQ_GETADDRINFO], [ 76AC_DEFUN([gl_PREREQ_GETADDRINFO], [
77 AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
37 AC_SEARCH_LIBS(gethostbyname, [inet nsl]) 78 AC_SEARCH_LIBS(gethostbyname, [inet nsl])
38 AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet]) 79 AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet])
39 AC_CHECK_FUNCS(gethostbyname,, [ 80 AC_CHECK_FUNCS(gethostbyname,, [
@@ -46,7 +87,8 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
46#ifdef HAVE_WINSOCK2_H 87#ifdef HAVE_WINSOCK2_H
47#include <winsock2.h> 88#include <winsock2.h>
48#endif 89#endif
49], [gethostbyname(0);], gl_cv_w32_gethostbyname=yes) 90#include <stddef.h>
91], [gethostbyname(NULL);], gl_cv_w32_gethostbyname=yes)
50 LIBS="$am_save_LIBS"]) 92 LIBS="$am_save_LIBS"])
51 if test "$gl_cv_w32_gethostbyname" = "yes"; then 93 if test "$gl_cv_w32_gethostbyname" = "yes"; then
52 LIBS="$LIBS -lws2_32" 94 LIBS="$LIBS -lws2_32"
@@ -56,7 +98,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
56 AC_REQUIRE([gl_SOCKET_FAMILIES]) 98 AC_REQUIRE([gl_SOCKET_FAMILIES])
57 AC_REQUIRE([gl_HEADER_SYS_SOCKET]) 99 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
58 AC_REQUIRE([AC_C_INLINE]) 100 AC_REQUIRE([AC_C_INLINE])
59 AC_REQUIRE([AC_GNU_SOURCE]) 101 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
60 AC_CHECK_HEADERS_ONCE(netinet/in.h netdb.h) 102 AC_CHECK_HEADERS_ONCE(netinet/in.h netdb.h)
61 AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[ 103 AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[
62 /* sys/types.h is not needed according to POSIX, but the 104 /* sys/types.h is not needed according to POSIX, but the
diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4
index 82437291..c1547c74 100644
--- a/gl/m4/getloadavg.m4
+++ b/gl/m4/getloadavg.m4
@@ -31,6 +31,10 @@ AC_CHECK_FUNCS(pstat_getdynamic)
31AC_CHECK_LIB(kstat, kstat_open) 31AC_CHECK_LIB(kstat, kstat_open)
32test $ac_cv_lib_kstat_kstat_open = yes && gl_have_func=yes 32test $ac_cv_lib_kstat_kstat_open = yes && gl_have_func=yes
33 33
34# AIX has libperfstat which does not require root
35AC_CHECK_LIB(perfstat, perfstat_cpu_total)
36test $ac_cv_lib_perfstat_perfstat_cpu_total = yes && gl_have_func=yes
37
34# Some systems with -lutil have (and need) -lkvm as well, some do not. 38# Some systems with -lutil have (and need) -lkvm as well, some do not.
35# On Solaris, -lkvm requires nlist from -lelf, so check that first 39# On Solaris, -lkvm requires nlist from -lelf, so check that first
36# to get the right answer into the cache. 40# to get the right answer into the cache.
diff --git a/gl/m4/gettext.m4 b/gl/m4/gettext.m4
index 91c345e9..c9ae1f7d 100644
--- a/gl/m4/gettext.m4
+++ b/gl/m4/gettext.m4
@@ -1,5 +1,5 @@
1# gettext.m4 serial 59 (gettext-0.16.1) 1# gettext.m4 serial 60 (gettext-0.17)
2dnl Copyright (C) 1995-2006 Free Software Foundation, Inc. 2dnl Copyright (C) 1995-2007 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.
@@ -362,44 +362,6 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a
362]) 362])
363 363
364 364
365dnl Checks for special options needed on MacOS X.
366dnl Defines INTL_MACOSX_LIBS.
367AC_DEFUN([gt_INTL_MACOSX],
368[
369 dnl Check for API introduced in MacOS X 10.2.
370 AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
371 gt_cv_func_CFPreferencesCopyAppValue,
372 [gt_save_LIBS="$LIBS"
373 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
374 AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>],
375 [CFPreferencesCopyAppValue(NULL, NULL)],
376 [gt_cv_func_CFPreferencesCopyAppValue=yes],
377 [gt_cv_func_CFPreferencesCopyAppValue=no])
378 LIBS="$gt_save_LIBS"])
379 if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
380 AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1,
381 [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
382 fi
383 dnl Check for API introduced in MacOS X 10.3.
384 AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent,
385 [gt_save_LIBS="$LIBS"
386 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
387 AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();],
388 [gt_cv_func_CFLocaleCopyCurrent=yes],
389 [gt_cv_func_CFLocaleCopyCurrent=no])
390 LIBS="$gt_save_LIBS"])
391 if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
392 AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1,
393 [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
394 fi
395 INTL_MACOSX_LIBS=
396 if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
397 INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
398 fi
399 AC_SUBST([INTL_MACOSX_LIBS])
400])
401
402
403dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized. 365dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
404m4_define([gt_NEEDS_INIT], 366m4_define([gt_NEEDS_INIT],
405[ 367[
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
index e78c8604..6da4d657 100644
--- a/gl/m4/gnulib-cache.m4
+++ b/gl/m4/gnulib-cache.m4
@@ -15,7 +15,7 @@
15 15
16 16
17# Specification in the form of a command-line invocation: 17# Specification in the form of a command-line invocation:
18# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=gl dirname fsusage getaddrinfo gethostname getloadavg getopt gettext mountlist regex vasprintf vsnprintf 18# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --aux-dir=build-aux --no-libtool --macro-prefix=gl dirname fsusage getaddrinfo gethostname getloadavg getopt gettext mountlist regex vasprintf vsnprintf
19 19
20# Specification in the form of a few gnulib-tool.m4 macro invocations: 20# Specification in the form of a few gnulib-tool.m4 macro invocations:
21gl_LOCAL_DIR([]) 21gl_LOCAL_DIR([])
@@ -23,8 +23,10 @@ gl_MODULES([dirname fsusage getaddrinfo gethostname getloadavg getopt gettext mo
23gl_AVOID([]) 23gl_AVOID([])
24gl_SOURCE_BASE([gl]) 24gl_SOURCE_BASE([gl])
25gl_M4_BASE([gl/m4]) 25gl_M4_BASE([gl/m4])
26gl_PO_BASE([])
26gl_DOC_BASE([doc]) 27gl_DOC_BASE([doc])
27gl_TESTS_BASE([tests]) 28gl_TESTS_BASE([tests])
28gl_LIB([libgnu]) 29gl_LIB([libgnu])
29gl_MAKEFILE_NAME([]) 30gl_MAKEFILE_NAME([])
30gl_MACRO_PREFIX([gl]) 31gl_MACRO_PREFIX([gl])
32gl_PO_DOMAIN([])
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4
index 53980108..9336d726 100644
--- a/gl/m4/gnulib-common.m4
+++ b/gl/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
1# gnulib-common.m4 serial 2 1# gnulib-common.m4 serial 3
2dnl Copyright (C) 2007 Free Software Foundation, Inc. 2dnl Copyright (C) 2007 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,
@@ -20,3 +20,46 @@ m4_ifdef([AC_PROG_MKDIR_P], [], [
20 [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake 20 [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
21 MKDIR_P='$(mkdir_p)' 21 MKDIR_P='$(mkdir_p)'
22 AC_SUBST([MKDIR_P])])]) 22 AC_SUBST([MKDIR_P])])])
23
24# AC_C_RESTRICT
25# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61,
26# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++
27# works.
28# This definition can be removed once autoconf >= 2.62 can be assumed.
29AC_DEFUN([AC_C_RESTRICT],
30[AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,
31 [ac_cv_c_restrict=no
32 # The order here caters to the fact that C++ does not require restrict.
33 for ac_kw in __restrict __restrict__ _Restrict restrict; do
34 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
35 [[typedef int * int_ptr;
36 int foo (int_ptr $ac_kw ip) {
37 return ip[0];
38 }]],
39 [[int s[1];
40 int * $ac_kw t = s;
41 t[0] = 0;
42 return foo(t)]])],
43 [ac_cv_c_restrict=$ac_kw])
44 test "$ac_cv_c_restrict" != no && break
45 done
46 ])
47 AH_VERBATIM([restrict],
48[/* Define to the equivalent of the C99 'restrict' keyword, or to
49 nothing if this is not supported. Do not define if restrict is
50 supported directly. */
51#undef restrict
52/* Work around a bug in Sun C++: it does not support _Restrict, even
53 though the corresponding Sun C compiler does, which causes
54 "#define restrict _Restrict" in the previous line. Perhaps some future
55 version of Sun C++ will work with _Restrict; if so, it'll probably
56 define __RESTRICT, just as Sun C does. */
57#if defined __SUNPRO_CC && !defined __RESTRICT
58# define _Restrict
59#endif])
60 case $ac_cv_c_restrict in
61 restrict) ;;
62 no) AC_DEFINE([restrict], []) ;;
63 *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
64 esac
65])
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index ed4da7d9..a17e36ad 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -27,78 +27,94 @@ AC_DEFUN([gl_EARLY],
27 AC_REQUIRE([AC_PROG_RANLIB]) 27 AC_REQUIRE([AC_PROG_RANLIB])
28 AC_REQUIRE([AC_GNU_SOURCE]) 28 AC_REQUIRE([AC_GNU_SOURCE])
29 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 29 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
30 AC_REQUIRE([gl_LOCK_EARLY])
31]) 30])
32 31
33# This macro should be invoked from ./configure.in, in the section 32# This macro should be invoked from ./configure.in, in the section
34# "Check for header files, types and library functions". 33# "Check for header files, types and library functions".
35AC_DEFUN([gl_INIT], 34AC_DEFUN([gl_INIT],
36[ 35[
37 m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
38 m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
39 m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
40 AM_CONDITIONAL([GL_COND_LIBTOOL], [false]) 36 AM_CONDITIONAL([GL_COND_LIBTOOL], [false])
41 gl_cond_libtool=false 37 gl_cond_libtool=false
42 gl_libdeps= 38 gl_libdeps=
43 gl_ltlibdeps= 39 gl_ltlibdeps=
40 m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
41 m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
42 m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
44 gl_source_base='gl' 43 gl_source_base='gl'
45 gl_FUNC_ALLOCA 44 gl_FUNC_ALLOCA
46 gl_HEADER_ARPA_INET 45 gl_HEADER_ARPA_INET
46 AC_PROG_MKDIR_P
47 gl_C_STRTOD 47 gl_C_STRTOD
48 gl_CLOEXEC 48 gl_CLOEXEC
49 gl_DIRNAME 49 gl_DIRNAME
50 gl_DOUBLE_SLASH_ROOT 50 gl_DOUBLE_SLASH_ROOT
51 gl_ERROR 51 gl_ERROR
52 m4_ifdef([AM_XGETTEXT_OPTION],
53 [AM_XGETTEXT_OPTION([--flag=error:3:c-format])
54 AM_XGETTEXT_OPTION([--flag=error_at_line:5:c-format])])
52 gl_EXITFAIL 55 gl_EXITFAIL
53 dnl gl_USE_SYSTEM_EXTENSIONS must be added quite early to configure.ac.
54 gl_FCNTL_SAFER 56 gl_FCNTL_SAFER
55 gl_MODULE_INDICATOR([fcntl-safer]) 57 gl_MODULE_INDICATOR([fcntl-safer])
58 gl_FLOAT_H
56 gl_FSUSAGE 59 gl_FSUSAGE
57 gl_GETADDRINFO 60 gl_GETADDRINFO
58 gl_FUNC_GETHOSTNAME 61 gl_FUNC_GETHOSTNAME
59 gl_GETLOADAVG([$gl_source_base]) 62 gl_GETLOADAVG([$gl_source_base])
60 gl_GETOPT 63 gl_GETOPT
61 dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac. 64 dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac.
62 AM_GNU_GETTEXT_VERSION([0.15]) 65 AM_GNU_GETTEXT_VERSION([0.17])
66 AC_SUBST([LIBINTL])
67 AC_SUBST([LTLIBINTL])
63 gl_INET_NTOP 68 gl_INET_NTOP
64 gl_INLINE 69 gl_INLINE
70 gl_LOCALCHARSET
71 LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\""
72 AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT])
65 AC_FUNC_MALLOC 73 AC_FUNC_MALLOC
66 gl_MBCHAR 74 AC_DEFINE([GNULIB_MALLOC_GNU], 1, [Define to indicate the 'malloc' module.])
67 gl_MBITER 75 gl_FUNC_MALLOC_POSIX
68 gl_FUNC_MEMCHR 76 gl_STDLIB_MODULE_INDICATOR([malloc-posix])
69 gl_MINMAX
70 gl_MOUNTLIST 77 gl_MOUNTLIST
71 gl_HEADER_NETINET_IN 78 gl_HEADER_NETINET_IN
79 AC_PROG_MKDIR_P
72 gl_REGEX 80 gl_REGEX
73 gl_SAFE_READ 81 gl_SAFE_READ
74 gl_SAFE_WRITE 82 gl_SAFE_WRITE
75 gl_SIZE_MAX 83 gl_SIZE_MAX
76 gl_FUNC_SNPRINTF 84 gl_FUNC_SNPRINTF
85 gl_STDIO_MODULE_INDICATOR([snprintf])
77 gl_TYPE_SOCKLEN_T 86 gl_TYPE_SOCKLEN_T
78 gt_TYPE_SSIZE_T 87 gt_TYPE_SSIZE_T
79 AM_STDBOOL_H 88 AM_STDBOOL_H
80 gl_STDINT_H 89 gl_STDINT_H
81 gl_STRCASE 90 gl_STDIO_H
91 gl_STDLIB_H
82 gl_FUNC_STRDUP 92 gl_FUNC_STRDUP
93 gl_STRING_MODULE_INDICATOR([strdup])
94 gl_FUNC_STRERROR
95 gl_STRING_MODULE_INDICATOR([strerror])
96 gl_HEADER_STRING_H
83 gl_FUNC_STRNDUP 97 gl_FUNC_STRNDUP
98 gl_STRING_MODULE_INDICATOR([strndup])
84 gl_FUNC_STRNLEN 99 gl_FUNC_STRNLEN
100 gl_STRING_MODULE_INDICATOR([strnlen])
85 gl_HEADER_SYS_SOCKET 101 gl_HEADER_SYS_SOCKET
86 AC_PROG_MKDIR_P 102 AC_PROG_MKDIR_P
87 gl_HEADER_UNISTD 103 gl_UNISTD_H
88 gl_UNISTD_SAFER 104 gl_UNISTD_SAFER
89 gl_FUNC_VASNPRINTF 105 gl_FUNC_VASNPRINTF
90 gl_FUNC_VASPRINTF 106 gl_FUNC_VASPRINTF
107 gl_STDIO_MODULE_INDICATOR([vasprintf])
108 m4_ifdef([AM_XGETTEXT_OPTION],
109 [AM_XGETTEXT_OPTION([--flag=asprintf:2:c-format])
110 AM_XGETTEXT_OPTION([--flag=vasprintf:2:c-format])])
91 gl_FUNC_VSNPRINTF 111 gl_FUNC_VSNPRINTF
112 gl_STDIO_MODULE_INDICATOR([vsnprintf])
92 gl_WCHAR_H 113 gl_WCHAR_H
93 gl_WCTYPE_H 114 gl_WCTYPE_H
94 gl_FUNC_WCWIDTH
95 gl_XALLOC 115 gl_XALLOC
96 gl_XSIZE 116 gl_XSIZE
97 gl_XSTRNDUP 117 gl_XSTRNDUP
98 LIBGNU_LIBDEPS="$gl_libdeps"
99 AC_SUBST([LIBGNU_LIBDEPS])
100 LIBGNU_LTLIBDEPS="$gl_ltlibdeps"
101 AC_SUBST([LIBGNU_LTLIBDEPS])
102 m4_popdef([AC_LIBSOURCES]) 118 m4_popdef([AC_LIBSOURCES])
103 m4_popdef([AC_REPLACE_FUNCS]) 119 m4_popdef([AC_REPLACE_FUNCS])
104 m4_popdef([AC_LIBOBJ]) 120 m4_popdef([AC_LIBOBJ])
@@ -116,29 +132,112 @@ AC_DEFUN([gl_INIT],
116 AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) 132 AC_SUBST([gl_LIBOBJS], [$gl_libobjs])
117 AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) 133 AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs])
118 ]) 134 ])
135 gltests_libdeps=
136 gltests_ltlibdeps=
137 m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ]))
138 m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS]))
139 m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES]))
140 gl_source_base='tests'
141 m4_popdef([AC_LIBSOURCES])
142 m4_popdef([AC_REPLACE_FUNCS])
143 m4_popdef([AC_LIBOBJ])
144 AC_CONFIG_COMMANDS_PRE([
145 gltests_libobjs=
146 gltests_ltlibobjs=
147 if test -n "$gltests_LIBOBJS"; then
148 # Remove the extension.
149 sed_drop_objext='s/\.o$//;s/\.obj$//'
150 for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
151 gltests_libobjs="$gltests_libobjs $i.$ac_objext"
152 gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
153 done
154 fi
155 AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs])
156 AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs])
157 ])
158 LIBGNU_LIBDEPS="$gl_libdeps"
159 AC_SUBST([LIBGNU_LIBDEPS])
160 LIBGNU_LTLIBDEPS="$gl_ltlibdeps"
161 AC_SUBST([LIBGNU_LTLIBDEPS])
119]) 162])
120 163
121# Like AC_LIBOBJ, except that the module name goes 164# Like AC_LIBOBJ, except that the module name goes
122# into gl_LIBOBJS instead of into LIBOBJS. 165# into gl_LIBOBJS instead of into LIBOBJS.
123AC_DEFUN([gl_LIBOBJ], 166AC_DEFUN([gl_LIBOBJ], [
124 [gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"]) 167 AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl
168 gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"
169])
170
171# m4_foreach_w is provided by autoconf-2.59c and later.
172# This definition is to accommodate developers using versions
173# of autoconf older than that.
174m4_ifndef([m4_foreach_w],
175 [m4_define([m4_foreach_w],
176 [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
125 177
126# Like AC_REPLACE_FUNCS, except that the module name goes 178# Like AC_REPLACE_FUNCS, except that the module name goes
127# into gl_LIBOBJS instead of into LIBOBJS. 179# into gl_LIBOBJS instead of into LIBOBJS.
128AC_DEFUN([gl_REPLACE_FUNCS], 180AC_DEFUN([gl_REPLACE_FUNCS], [
129 [AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])]) 181 m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
182 AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])
183])
184
185# Like AC_LIBSOURCES, except the directory where the source file is
186# expected is derived from the gnulib-tool parametrization,
187# and alloca is special cased (for the alloca-opt module).
188# We could also entirely rely on EXTRA_lib..._SOURCES.
189AC_DEFUN([gl_LIBSOURCES], [
190 m4_foreach([_gl_NAME], [$1], [
191 m4_if(_gl_NAME, [alloca.c], [], [
192 m4_syscmd([test -r gl/]_gl_NAME[ || test ! -d gl])dnl
193 m4_if(m4_sysval, [0], [],
194 [AC_FATAL([missing gl/]_gl_NAME)])
195 ])
196 ])
197])
198
199# Like AC_LIBOBJ, except that the module name goes
200# into gltests_LIBOBJS instead of into LIBOBJS.
201AC_DEFUN([gltests_LIBOBJ], [
202 AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl
203 gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext"
204])
205
206# m4_foreach_w is provided by autoconf-2.59c and later.
207# This definition is to accommodate developers using versions
208# of autoconf older than that.
209m4_ifndef([m4_foreach_w],
210 [m4_define([m4_foreach_w],
211 [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
130 212
131# Like AC_LIBSOURCES, except that it does nothing. 213# Like AC_REPLACE_FUNCS, except that the module name goes
132# We rely on EXTRA_lib..._SOURCES instead. 214# into gltests_LIBOBJS instead of into LIBOBJS.
133AC_DEFUN([gl_LIBSOURCES], 215AC_DEFUN([gltests_REPLACE_FUNCS], [
134 []) 216 m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
217 AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)])
218])
219
220# Like AC_LIBSOURCES, except the directory where the source file is
221# expected is derived from the gnulib-tool parametrization,
222# and alloca is special cased (for the alloca-opt module).
223# We could also entirely rely on EXTRA_lib..._SOURCES.
224AC_DEFUN([gltests_LIBSOURCES], [
225 m4_foreach([_gl_NAME], [$1], [
226 m4_if(_gl_NAME, [alloca.c], [], [
227 m4_syscmd([test -r tests/]_gl_NAME[ || test ! -d tests])dnl
228 m4_if(m4_sysval, [0], [],
229 [AC_FATAL([missing tests/]_gl_NAME)])
230 ])
231 ])
232])
135 233
136# This macro records the list of files which have been installed by 234# This macro records the list of files which have been installed by
137# gnulib-tool and may be removed by future gnulib-tool invocations. 235# gnulib-tool and may be removed by future gnulib-tool invocations.
138AC_DEFUN([gl_FILE_LIST], [ 236AC_DEFUN([gl_FILE_LIST], [
139 build-aux/config.rpath 237 build-aux/config.rpath
238 build-aux/link-warning.h
140 lib/alloca.c 239 lib/alloca.c
141 lib/alloca_.h 240 lib/alloca.in.h
142 lib/asnprintf.c 241 lib/asnprintf.c
143 lib/asprintf.c 242 lib/asprintf.c
144 lib/basename.c 243 lib/basename.c
@@ -146,18 +245,20 @@ AC_DEFUN([gl_FILE_LIST], [
146 lib/c-strtod.h 245 lib/c-strtod.h
147 lib/cloexec.c 246 lib/cloexec.c
148 lib/cloexec.h 247 lib/cloexec.h
248 lib/config.charset
149 lib/creat-safer.c 249 lib/creat-safer.c
150 lib/dirname.c 250 lib/dirname.c
151 lib/dirname.h 251 lib/dirname.h
152 lib/dup-safer.c 252 lib/dup-safer.c
153 lib/error.c 253 lib/error.c
154 lib/error.h 254 lib/error.h
155 lib/exit.h
156 lib/exitfail.c 255 lib/exitfail.c
157 lib/exitfail.h 256 lib/exitfail.h
158 lib/fcntl--.h 257 lib/fcntl--.h
159 lib/fcntl-safer.h 258 lib/fcntl-safer.h
160 lib/fd-safer.c 259 lib/fd-safer.c
260 lib/float+.h
261 lib/float.in.h
161 lib/fsusage.c 262 lib/fsusage.c
162 lib/fsusage.h 263 lib/fsusage.h
163 lib/full-read.c 264 lib/full-read.c
@@ -170,27 +271,27 @@ AC_DEFUN([gl_FILE_LIST], [
170 lib/gethostname.c 271 lib/gethostname.c
171 lib/getloadavg.c 272 lib/getloadavg.c
172 lib/getopt.c 273 lib/getopt.c
274 lib/getopt.in.h
173 lib/getopt1.c 275 lib/getopt1.c
174 lib/getopt_.h
175 lib/getopt_int.h 276 lib/getopt_int.h
176 lib/gettext.h 277 lib/gettext.h
177 lib/inet_ntop.c 278 lib/inet_ntop.c
178 lib/inet_ntop.h 279 lib/inet_ntop.h
179 lib/intprops.h 280 lib/intprops.h
281 lib/localcharset.c
282 lib/localcharset.h
180 lib/malloc.c 283 lib/malloc.c
181 lib/mbchar.c
182 lib/mbchar.h
183 lib/mbuiter.h
184 lib/memchr.c
185 lib/minmax.h
186 lib/mountlist.c 284 lib/mountlist.c
187 lib/mountlist.h 285 lib/mountlist.h
286 lib/netinet_in.in.h
188 lib/open-safer.c 287 lib/open-safer.c
189 lib/pipe-safer.c 288 lib/pipe-safer.c
190 lib/printf-args.c 289 lib/printf-args.c
191 lib/printf-args.h 290 lib/printf-args.h
192 lib/printf-parse.c 291 lib/printf-parse.c
193 lib/printf-parse.h 292 lib/printf-parse.h
293 lib/ref-add.sin
294 lib/ref-del.sin
194 lib/regcomp.c 295 lib/regcomp.c
195 lib/regex.c 296 lib/regex.c
196 lib/regex.h 297 lib/regex.h
@@ -203,34 +304,26 @@ AC_DEFUN([gl_FILE_LIST], [
203 lib/safe-write.h 304 lib/safe-write.h
204 lib/size_max.h 305 lib/size_max.h
205 lib/snprintf.c 306 lib/snprintf.c
206 lib/snprintf.h 307 lib/stdbool.in.h
207 lib/socket_.h 308 lib/stdint.in.h
208 lib/stdbool_.h 309 lib/stdio.in.h
209 lib/stdint_.h 310 lib/stdlib.in.h
210 lib/strcase.h
211 lib/strcasecmp.c
212 lib/strdup.c 311 lib/strdup.c
213 lib/strdup.h 312 lib/strerror.c
313 lib/string.in.h
214 lib/stripslash.c 314 lib/stripslash.c
215 lib/strncasecmp.c
216 lib/strndup.c 315 lib/strndup.c
217 lib/strndup.h
218 lib/strnlen.c 316 lib/strnlen.c
219 lib/strnlen.h 317 lib/sys_socket.in.h
220 lib/strnlen1.c
221 lib/strnlen1.h
222 lib/unistd--.h 318 lib/unistd--.h
223 lib/unistd-safer.h 319 lib/unistd-safer.h
224 lib/unistd_.h 320 lib/unistd.in.h
225 lib/vasnprintf.c 321 lib/vasnprintf.c
226 lib/vasnprintf.h 322 lib/vasnprintf.h
227 lib/vasprintf.c 323 lib/vasprintf.c
228 lib/vasprintf.h
229 lib/vsnprintf.c 324 lib/vsnprintf.c
230 lib/vsnprintf.h 325 lib/wchar.in.h
231 lib/wchar_.h 326 lib/wctype.in.h
232 lib/wctype_.h
233 lib/wcwidth.h
234 lib/xalloc-die.c 327 lib/xalloc-die.c
235 lib/xalloc.h 328 lib/xalloc.h
236 lib/xmalloc.c 329 lib/xmalloc.c
@@ -251,6 +344,7 @@ AC_DEFUN([gl_FILE_LIST], [
251 m4/exitfail.m4 344 m4/exitfail.m4
252 m4/extensions.m4 345 m4/extensions.m4
253 m4/fcntl-safer.m4 346 m4/fcntl-safer.m4
347 m4/float_h.m4
254 m4/fstypename.m4 348 m4/fstypename.m4
255 m4/fsusage.m4 349 m4/fsusage.m4
256 m4/getaddrinfo.m4 350 m4/getaddrinfo.m4
@@ -262,11 +356,13 @@ AC_DEFUN([gl_FILE_LIST], [
262 m4/glibc21.m4 356 m4/glibc21.m4
263 m4/gnulib-common.m4 357 m4/gnulib-common.m4
264 m4/iconv.m4 358 m4/iconv.m4
359 m4/include_next.m4
265 m4/inet_ntop.m4 360 m4/inet_ntop.m4
266 m4/inline.m4 361 m4/inline.m4
267 m4/intdiv0.m4 362 m4/intdiv0.m4
268 m4/intl.m4 363 m4/intl.m4
269 m4/intldir.m4 364 m4/intldir.m4
365 m4/intlmacosx.m4
270 m4/intmax.m4 366 m4/intmax.m4
271 m4/intmax_t.m4 367 m4/intmax_t.m4
272 m4/inttypes-pri.m4 368 m4/inttypes-pri.m4
@@ -275,15 +371,11 @@ AC_DEFUN([gl_FILE_LIST], [
275 m4/lib-ld.m4 371 m4/lib-ld.m4
276 m4/lib-link.m4 372 m4/lib-link.m4
277 m4/lib-prefix.m4 373 m4/lib-prefix.m4
374 m4/localcharset.m4
278 m4/lock.m4 375 m4/lock.m4
279 m4/longdouble.m4
280 m4/longlong.m4 376 m4/longlong.m4
281 m4/ls-mntd-fs.m4 377 m4/ls-mntd-fs.m4
282 m4/mbchar.m4 378 m4/malloc.m4
283 m4/mbiter.m4
284 m4/mbrtowc.m4
285 m4/memchr.m4
286 m4/minmax.m4
287 m4/mountlist.m4 379 m4/mountlist.m4
288 m4/netinet_in_h.m4 380 m4/netinet_in_h.m4
289 m4/nls.m4 381 m4/nls.m4
@@ -302,13 +394,15 @@ AC_DEFUN([gl_FILE_LIST], [
302 m4/stdbool.m4 394 m4/stdbool.m4
303 m4/stdint.m4 395 m4/stdint.m4
304 m4/stdint_h.m4 396 m4/stdint_h.m4
305 m4/strcase.m4 397 m4/stdio_h.m4
398 m4/stdlib_h.m4
306 m4/strdup.m4 399 m4/strdup.m4
400 m4/strerror.m4
401 m4/string_h.m4
307 m4/strndup.m4 402 m4/strndup.m4
308 m4/strnlen.m4 403 m4/strnlen.m4
309 m4/sys_socket_h.m4 404 m4/sys_socket_h.m4
310 m4/uintmax_t.m4 405 m4/uintmax_t.m4
311 m4/ulonglong.m4
312 m4/unistd-safer.m4 406 m4/unistd-safer.m4
313 m4/unistd_h.m4 407 m4/unistd_h.m4
314 m4/vasnprintf.m4 408 m4/vasnprintf.m4
@@ -318,7 +412,6 @@ AC_DEFUN([gl_FILE_LIST], [
318 m4/wchar.m4 412 m4/wchar.m4
319 m4/wchar_t.m4 413 m4/wchar_t.m4
320 m4/wctype.m4 414 m4/wctype.m4
321 m4/wcwidth.m4
322 m4/wint_t.m4 415 m4/wint_t.m4
323 m4/xalloc.m4 416 m4/xalloc.m4
324 m4/xsize.m4 417 m4/xsize.m4
diff --git a/gl/m4/iconv.m4 b/gl/m4/iconv.m4
index 654c4158..66bc76f4 100644
--- a/gl/m4/iconv.m4
+++ b/gl/m4/iconv.m4
@@ -1,5 +1,5 @@
1# iconv.m4 serial AM4 (gettext-0.11.3) 1# iconv.m4 serial AM6 (gettext-0.17)
2dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2007 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.
@@ -21,6 +21,7 @@ AC_DEFUN([AM_ICONV_LINK],
21[ 21[
22 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and 22 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
23 dnl those with the standalone portable GNU libiconv installed). 23 dnl those with the standalone portable GNU libiconv installed).
24 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
24 25
25 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV 26 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
26 dnl accordingly. 27 dnl accordingly.
@@ -33,7 +34,7 @@ AC_DEFUN([AM_ICONV_LINK],
33 am_save_CPPFLAGS="$CPPFLAGS" 34 am_save_CPPFLAGS="$CPPFLAGS"
34 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) 35 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
35 36
36 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ 37 AC_CACHE_CHECK([for iconv], am_cv_func_iconv, [
37 am_cv_func_iconv="no, consider installing GNU libiconv" 38 am_cv_func_iconv="no, consider installing GNU libiconv"
38 am_cv_lib_iconv=no 39 am_cv_lib_iconv=no
39 AC_TRY_LINK([#include <stdlib.h> 40 AC_TRY_LINK([#include <stdlib.h>
@@ -56,7 +57,85 @@ AC_DEFUN([AM_ICONV_LINK],
56 fi 57 fi
57 ]) 58 ])
58 if test "$am_cv_func_iconv" = yes; then 59 if test "$am_cv_func_iconv" = yes; then
59 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) 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.
62 am_save_LIBS="$LIBS"
63 if test $am_cv_lib_iconv = yes; then
64 LIBS="$LIBS $LIBICONV"
65 fi
66 AC_TRY_RUN([
67#include <iconv.h>
68#include <string.h>
69int main ()
70{
71 /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
72 returns. */
73 {
74 iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
75 if (cd_utf8_to_88591 != (iconv_t)(-1))
76 {
77 static const char input[] = "\342\202\254"; /* EURO SIGN */
78 char buf[10];
79 const char *inptr = input;
80 size_t inbytesleft = strlen (input);
81 char *outptr = buf;
82 size_t outbytesleft = sizeof (buf);
83 size_t res = iconv (cd_utf8_to_88591,
84 (char **) &inptr, &inbytesleft,
85 &outptr, &outbytesleft);
86 if (res == 0)
87 return 1;
88 }
89 }
90#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. */
92 {
93 iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
94 if (cd_88591_to_utf8 != (iconv_t)(-1))
95 {
96 static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
97 char buf[50];
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_88591_to_utf8,
103 (char **) &inptr, &inbytesleft,
104 &outptr, &outbytesleft);
105 if ((int)res > 0)
106 return 1;
107 }
108 }
109#endif
110 /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
111 provided. */
112 if (/* Try standardized names. */
113 iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
114 /* Try IRIX, OSF/1 names. */
115 && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
116 /* Try AIX names. */
117 && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
118 /* Try HP-UX names. */
119 && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
120 return 1;
121 return 0;
122}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
123 [case "$host_os" in
124 aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
125 *) am_cv_func_iconv_works="guessing yes" ;;
126 esac])
127 LIBS="$am_save_LIBS"
128 ])
129 case "$am_cv_func_iconv_works" in
130 *no) am_func_iconv=no am_cv_lib_iconv=no ;;
131 *) am_func_iconv=yes ;;
132 esac
133 else
134 am_func_iconv=no am_cv_lib_iconv=no
135 fi
136 if test "$am_func_iconv" = yes; then
137 AC_DEFINE(HAVE_ICONV, 1,
138 [Define if you have the iconv() function and it works.])
60 fi 139 fi
61 if test "$am_cv_lib_iconv" = yes; then 140 if test "$am_cv_lib_iconv" = yes; then
62 AC_MSG_CHECKING([how to link with libiconv]) 141 AC_MSG_CHECKING([how to link with libiconv])
diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4
new file mode 100644
index 00000000..7ce472bc
--- /dev/null
+++ b/gl/m4/include_next.m4
@@ -0,0 +1,107 @@
1# include_next.m4 serial 4
2dnl Copyright (C) 2006, 2007 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 Paul Eggert and Derek Price.
8
9AC_DEFUN([gl_INCLUDE_NEXT],
10[
11 AC_LANG_PREPROC_REQUIRE()
12 AC_CACHE_CHECK([whether the preprocessor supports include_next],
13 [gl_cv_have_include_next],
14 [rm -rf conftestd1 conftestd2
15 mkdir conftestd1 conftestd2
16 cat <<EOF > conftestd1/conftest.h
17#define DEFINED_IN_CONFTESTD1
18#include_next <conftest.h>
19#ifdef DEFINED_IN_CONFTESTD2
20int foo;
21#else
22#error "include_next doesn't work"
23#endif
24EOF
25 cat <<EOF > conftestd2/conftest.h
26#ifndef DEFINED_IN_CONFTESTD1
27#error "include_next test doesn't work"
28#endif
29#define DEFINED_IN_CONFTESTD2
30EOF
31 save_CPPFLAGS="$CPPFLAGS"
32 CPPFLAGS="$CPPFLAGS -Iconftestd1 -Iconftestd2"
33 AC_COMPILE_IFELSE([#include <conftest.h>],
34 [gl_cv_have_include_next=yes],
35 [gl_cv_have_include_next=no])
36 CPPFLAGS="$save_CPPFLAGS"
37 rm -rf conftestd1 conftestd2
38 ])
39 if test $gl_cv_have_include_next = yes; then
40
41 dnl FIXME: Remove HAVE_INCLUDE_NEXT and update everything that uses it
42 dnl to use @INCLUDE_NEXT@ instead.
43 AC_DEFINE([HAVE_INCLUDE_NEXT], 1,
44 [Define if your compiler supports the #include_next directive.])
45
46 INCLUDE_NEXT=include_next
47 else
48 INCLUDE_NEXT=include
49 fi
50 AC_SUBST([INCLUDE_NEXT])
51])
52
53# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
54# ------------------------------------------
55# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
56# '<foo.h>'; otherwise define it to be
57# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
58# That way, a header file with the following line:
59# #@INCLUDE_NEXT@ @NEXT_FOO_H@
60# behaves (after sed substitution) as if it contained
61# #include_next <foo.h>
62# even if the compiler does not support include_next.
63# The three "///" are to pacify Sun C 5.8, which otherwise would say
64# "warning: #include of /usr/include/... may be non-portable".
65# Use `""', not `<>', so that the /// cannot be confused with a C99 comment.
66AC_DEFUN([gl_CHECK_NEXT_HEADERS],
67[
68 AC_REQUIRE([gl_INCLUDE_NEXT])
69 AC_CHECK_HEADERS_ONCE([$1])
70
71 AC_FOREACH([gl_HEADER_NAME], [$1],
72 [AS_VAR_PUSHDEF([gl_next_header],
73 [gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME])))
74 if test $gl_cv_have_include_next = yes; then
75 AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
76 else
77 AC_CACHE_CHECK(
78 [absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>],
79 m4_quote(m4_defn([gl_next_header])),
80 [AS_VAR_PUSHDEF([gl_header_exists],
81 [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))
82 if test AS_VAR_GET(gl_header_exists) = yes; then
83 AC_LANG_CONFTEST(
84 [AC_LANG_SOURCE(
85 [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
86 )])
87 dnl eval is necessary to expand ac_cpp.
88 dnl Ultrix and Pyramid sh refuse to redirect output of eval,
89 dnl so use subshell.
90 AS_VAR_SET([gl_next_header],
91 ['"'`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
92 sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{
93 s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#
94 s#^/[^/]#//&#
95 p
96 q
97 }'`'"'])
98 else
99 AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
100 fi
101 AS_VAR_POPDEF([gl_header_exists])])
102 fi
103 AC_SUBST(
104 AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))),
105 [AS_VAR_GET([gl_next_header])])
106 AS_VAR_POPDEF([gl_next_header])])
107])
diff --git a/gl/m4/intdiv0.m4 b/gl/m4/intdiv0.m4
index b8d78176..8c8a6708 100644
--- a/gl/m4/intdiv0.m4
+++ b/gl/m4/intdiv0.m4
@@ -1,5 +1,5 @@
1# intdiv0.m4 serial 1 (gettext-0.11.3) 1# intdiv0.m4 serial 2 (gettext-0.17)
2dnl Copyright (C) 2002 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2007 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -14,16 +14,27 @@ AC_DEFUN([gt_INTDIV0],
14 AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], 14 AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
15 gt_cv_int_divbyzero_sigfpe, 15 gt_cv_int_divbyzero_sigfpe,
16 [ 16 [
17 AC_TRY_RUN([ 17 gt_cv_int_divbyzero_sigfpe=
18changequote(,)dnl
19 case "$host_os" in
20 macos* | darwin[6-9]* | darwin[1-9][0-9]*)
21 # On MacOS X 10.2 or newer, just assume the same as when cross-
22 # compiling. If we were to perform the real test, 1 Crash Report
23 # dialog window would pop up.
24 case "$host_cpu" in
25 i[34567]86 | x86_64)
26 gt_cv_int_divbyzero_sigfpe="guessing yes" ;;
27 esac
28 ;;
29 esac
30changequote([,])dnl
31 if test -z "$gt_cv_int_divbyzero_sigfpe"; then
32 AC_TRY_RUN([
18#include <stdlib.h> 33#include <stdlib.h>
19#include <signal.h> 34#include <signal.h>
20 35
21static void 36static void
22#ifdef __cplusplus
23sigfpe_handler (int sig) 37sigfpe_handler (int sig)
24#else
25sigfpe_handler (sig) int sig;
26#endif
27{ 38{
28 /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ 39 /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
29 exit (sig != SIGFPE); 40 exit (sig != SIGFPE);
@@ -51,15 +62,18 @@ int main ()
51 exit (1); 62 exit (1);
52} 63}
53], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, 64], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
54 [ 65 [
55 # Guess based on the CPU. 66 # Guess based on the CPU.
56 case "$host_cpu" in 67changequote(,)dnl
57 alpha* | i[34567]86 | m68k | s390*) 68 case "$host_cpu" in
58 gt_cv_int_divbyzero_sigfpe="guessing yes";; 69 alpha* | i[34567]86 | x86_64 | m68k | s390*)
59 *) 70 gt_cv_int_divbyzero_sigfpe="guessing yes";;
60 gt_cv_int_divbyzero_sigfpe="guessing no";; 71 *)
61 esac 72 gt_cv_int_divbyzero_sigfpe="guessing no";;
62 ]) 73 esac
74changequote([,])dnl
75 ])
76 fi
63 ]) 77 ])
64 case "$gt_cv_int_divbyzero_sigfpe" in 78 case "$gt_cv_int_divbyzero_sigfpe" in
65 *yes) value=1;; 79 *yes) value=1;;
diff --git a/gl/m4/intl.m4 b/gl/m4/intl.m4
index dcefb118..934408bb 100644
--- a/gl/m4/intl.m4
+++ b/gl/m4/intl.m4
@@ -1,5 +1,5 @@
1# intl.m4 serial 3 (gettext-0.16) 1# intl.m4 serial 8 (gettext-0.17)
2dnl Copyright (C) 1995-2006 Free Software Foundation, Inc. 2dnl Copyright (C) 1995-2007 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.
@@ -33,7 +33,6 @@ AC_DEFUN([AM_INTL_SUBDIR],
33 AC_REQUIRE([gl_VISIBILITY])dnl 33 AC_REQUIRE([gl_VISIBILITY])dnl
34 AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl 34 AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl
35 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])dnl 35 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])dnl
36 AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl
37 AC_REQUIRE([gt_TYPE_WCHAR_T])dnl 36 AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
38 AC_REQUIRE([gt_TYPE_WINT_T])dnl 37 AC_REQUIRE([gt_TYPE_WINT_T])dnl
39 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) 38 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
@@ -98,7 +97,7 @@ AC_DEFUN([AM_INTL_SUBDIR],
98 dnl exported variables _also_ in the static library. 97 dnl exported variables _also_ in the static library.
99 if test "$enable_shared" = yes; then 98 if test "$enable_shared" = yes; then
100 case "$host_os" in 99 case "$host_os" in
101 cygwin*) is_woe32dll=yes ;; 100 mingw* | cygwin*) is_woe32dll=yes ;;
102 *) is_woe32dll=no ;; 101 *) is_woe32dll=no ;;
103 esac 102 esac
104 else 103 else
@@ -107,6 +106,31 @@ AC_DEFUN([AM_INTL_SUBDIR],
107 WOE32DLL=$is_woe32dll 106 WOE32DLL=$is_woe32dll
108 AC_SUBST([WOE32DLL]) 107 AC_SUBST([WOE32DLL])
109 108
109 dnl On mingw and Cygwin, we can activate special Makefile rules which add
110 dnl version information to the shared libraries and executables.
111 case "$host_os" in
112 mingw* | cygwin*) is_woe32=yes ;;
113 *) is_woe32=no ;;
114 esac
115 WOE32=$is_woe32
116 AC_SUBST([WOE32])
117 if test $WOE32 = yes; then
118 dnl Check for a program that compiles Windows resource files.
119 AC_CHECK_TOOL([WINDRES], [windres])
120 fi
121
122 dnl Determine whether when creating a library, "-lc" should be passed to
123 dnl libtool or not. On many platforms, it is required for the libtool option
124 dnl -no-undefined to work. On HP-UX, however, the -lc - stored by libtool
125 dnl in the *.la files - makes it impossible to create multithreaded programs,
126 dnl because libtool also reorders the -lc to come before the -pthread, and
127 dnl this disables pthread_create() <http://docs.hp.com/en/1896/pthreads.html>.
128 case "$host_os" in
129 hpux*) LTLIBC="" ;;
130 *) LTLIBC="-lc" ;;
131 esac
132 AC_SUBST([LTLIBC])
133
110 dnl Rename some macros and functions used for locking. 134 dnl Rename some macros and functions used for locking.
111 AH_BOTTOM([ 135 AH_BOTTOM([
112#define __libc_lock_t gl_lock_t 136#define __libc_lock_t gl_lock_t
@@ -197,7 +221,9 @@ AC_DEFUN([gt_INTL_SUBDIR_CORE],
197 AC_CACHE_CHECK([for NL_LOCALE_NAME macro], gt_cv_nl_locale_name, 221 AC_CACHE_CHECK([for NL_LOCALE_NAME macro], gt_cv_nl_locale_name,
198 [AC_TRY_LINK([#include <langinfo.h> 222 [AC_TRY_LINK([#include <langinfo.h>
199#include <locale.h>], 223#include <locale.h>],
200 [char* cs = nl_langinfo(_NL_LOCALE_NAME(LC_MESSAGES));], 224 [char* cs = nl_langinfo(_NL_LOCALE_NAME(LC_MESSAGES));
225 return !cs;
226 ],
201 gt_cv_nl_locale_name=yes, 227 gt_cv_nl_locale_name=yes,
202 gt_cv_nl_locale_name=no) 228 gt_cv_nl_locale_name=no)
203 ]) 229 ])
diff --git a/gl/m4/intlmacosx.m4 b/gl/m4/intlmacosx.m4
new file mode 100644
index 00000000..d3f0d904
--- /dev/null
+++ b/gl/m4/intlmacosx.m4
@@ -0,0 +1,51 @@
1# intlmacosx.m4 serial 1 (gettext-0.17)
2dnl Copyright (C) 2004-2007 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.
6dnl
7dnl This file can can be used in projects which are not available under
8dnl the GNU General Public License or the GNU Library General Public
9dnl License but which still want to provide support for the GNU gettext
10dnl functionality.
11dnl Please note that the actual code of the GNU gettext library is covered
12dnl by the GNU Library General Public License, and the rest of the GNU
13dnl gettext package package is covered by the GNU General Public License.
14dnl They are *not* in the public domain.
15
16dnl Checks for special options needed on MacOS X.
17dnl Defines INTL_MACOSX_LIBS.
18AC_DEFUN([gt_INTL_MACOSX],
19[
20 dnl Check for API introduced in MacOS X 10.2.
21 AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
22 gt_cv_func_CFPreferencesCopyAppValue,
23 [gt_save_LIBS="$LIBS"
24 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
25 AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>],
26 [CFPreferencesCopyAppValue(NULL, NULL)],
27 [gt_cv_func_CFPreferencesCopyAppValue=yes],
28 [gt_cv_func_CFPreferencesCopyAppValue=no])
29 LIBS="$gt_save_LIBS"])
30 if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
31 AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1,
32 [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
33 fi
34 dnl Check for API introduced in MacOS X 10.3.
35 AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent,
36 [gt_save_LIBS="$LIBS"
37 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
38 AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();],
39 [gt_cv_func_CFLocaleCopyCurrent=yes],
40 [gt_cv_func_CFLocaleCopyCurrent=no])
41 LIBS="$gt_save_LIBS"])
42 if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
43 AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1,
44 [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
45 fi
46 INTL_MACOSX_LIBS=
47 if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
48 INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
49 fi
50 AC_SUBST([INTL_MACOSX_LIBS])
51])
diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4
index 17c7b0ae..50ae35d2 100644
--- a/gl/m4/intmax_t.m4
+++ b/gl/m4/intmax_t.m4
@@ -1,5 +1,5 @@
1# intmax_t.m4 serial 5 1# intmax_t.m4 serial 6
2dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2004, 2006-2007 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -18,8 +18,8 @@ AC_DEFUN([gl_AC_TYPE_INTMAX_T],
18 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) 18 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
19 AC_REQUIRE([gl_AC_HEADER_STDINT_H]) 19 AC_REQUIRE([gl_AC_HEADER_STDINT_H])
20 if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then 20 if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
21 AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) 21 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
22 test $ac_cv_type_long_long = yes \ 22 test $ac_cv_type_long_long_int = yes \
23 && ac_type='long long' \ 23 && ac_type='long long' \
24 || ac_type='long' 24 || ac_type='long'
25 AC_DEFINE_UNQUOTED(intmax_t, $ac_type, 25 AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
@@ -51,8 +51,8 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T],
51 AC_DEFINE(HAVE_INTMAX_T, 1, 51 AC_DEFINE(HAVE_INTMAX_T, 1,
52 [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) 52 [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
53 else 53 else
54 AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) 54 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
55 test $ac_cv_type_long_long = yes \ 55 test $ac_cv_type_long_long_int = yes \
56 && ac_type='long long' \ 56 && ac_type='long long' \
57 || ac_type='long' 57 || ac_type='long'
58 AC_DEFINE_UNQUOTED(intmax_t, $ac_type, 58 AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
diff --git a/gl/m4/lib-link.m4 b/gl/m4/lib-link.m4
index f157d983..e3d26fc4 100644
--- a/gl/m4/lib-link.m4
+++ b/gl/m4/lib-link.m4
@@ -1,4 +1,4 @@
1# lib-link.m4 serial 13 (gettext-0.16.2) 1# lib-link.m4 serial 13 (gettext-0.17)
2dnl Copyright (C) 2001-2007 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2007 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,
diff --git a/gl/m4/localcharset.m4 b/gl/m4/localcharset.m4
new file mode 100644
index 00000000..b2b77338
--- /dev/null
+++ b/gl/m4/localcharset.m4
@@ -0,0 +1,16 @@
1# localcharset.m4 serial 5
2dnl Copyright (C) 2002, 2004, 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_LOCALCHARSET],
8[
9 dnl Prerequisites of lib/localcharset.c.
10 AC_REQUIRE([AM_LANGINFO_CODESET])
11 AC_CHECK_DECLS_ONCE(getc_unlocked)
12
13 dnl Prerequisites of the lib/Makefile.am snippet.
14 AC_REQUIRE([AC_CANONICAL_HOST])
15 AC_REQUIRE([gl_GLIBC21])
16])
diff --git a/gl/m4/lock.m4 b/gl/m4/lock.m4
index 0224f2ff..91119335 100644
--- a/gl/m4/lock.m4
+++ b/gl/m4/lock.m4
@@ -1,5 +1,5 @@
1# lock.m4 serial 6 (gettext-0.16) 1# lock.m4 serial 7 (gettext-0.17)
2dnl Copyright (C) 2005-2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2005-2007 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -35,7 +35,12 @@ AC_DEFUN([gl_LOCK_EARLY_BODY],
35 AC_BEFORE([$0], [gl_ARGP])dnl 35 AC_BEFORE([$0], [gl_ARGP])dnl
36 36
37 AC_REQUIRE([AC_CANONICAL_HOST]) 37 AC_REQUIRE([AC_CANONICAL_HOST])
38 AC_REQUIRE([AC_GNU_SOURCE]) dnl needed for pthread_rwlock_t on glibc systems 38 dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems.
39 dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes
40 dnl AC_GNU_SOURCE.
41 m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],
42 [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])],
43 [AC_REQUIRE([AC_GNU_SOURCE])])
39 dnl Check for multithreading. 44 dnl Check for multithreading.
40 AC_ARG_ENABLE(threads, 45 AC_ARG_ENABLE(threads,
41AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API]) 46AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API])
diff --git a/gl/m4/longdouble.m4 b/gl/m4/longdouble.m4
deleted file mode 100644
index 25590f47..00000000
--- a/gl/m4/longdouble.m4
+++ /dev/null
@@ -1,31 +0,0 @@
1# longdouble.m4 serial 2 (gettext-0.15)
2dnl Copyright (C) 2002-2003, 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
7dnl From Bruno Haible.
8dnl Test whether the compiler supports the 'long double' type.
9dnl Prerequisite: AC_PROG_CC
10
11dnl This file is only needed in autoconf <= 2.59. Newer versions of autoconf
12dnl have a macro AC_TYPE_LONG_DOUBLE with identical semantics.
13
14AC_DEFUN([gt_TYPE_LONGDOUBLE],
15[
16 AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
17 [if test "$GCC" = yes; then
18 gt_cv_c_long_double=yes
19 else
20 AC_TRY_COMPILE([
21 /* The Stardent Vistra knows sizeof(long double), but does not support it. */
22 long double foo = 0.0;
23 /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
24 int array [2*(sizeof(long double) >= sizeof(double)) - 1];
25 ], ,
26 gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
27 fi])
28 if test $gt_cv_c_long_double = yes; then
29 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
30 fi
31])
diff --git a/gl/m4/longlong.m4 b/gl/m4/longlong.m4
index 1f9e862e..15bf9dac 100644
--- a/gl/m4/longlong.m4
+++ b/gl/m4/longlong.m4
@@ -1,5 +1,5 @@
1# longlong.m4 serial 10 1# longlong.m4 serial 13
2dnl Copyright (C) 1999-2006 Free Software Foundation, Inc. 2dnl Copyright (C) 1999-2007 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -7,8 +7,8 @@ dnl with or without modifications, as long as this notice is preserved.
7dnl From Paul Eggert. 7dnl From Paul Eggert.
8 8
9# Define HAVE_LONG_LONG_INT if 'long long int' works. 9# Define HAVE_LONG_LONG_INT if 'long long int' works.
10# This fixes a bug in Autoconf 2.60, but can be removed once we 10# This fixes a bug in Autoconf 2.61, but can be removed once we
11# assume 2.61 everywhere. 11# assume 2.62 everywhere.
12 12
13# Note: If the type 'long long int' exists but is only 32 bits large 13# Note: If the type 'long long int' exists but is only 32 bits large
14# (as on some very old compilers), HAVE_LONG_LONG_INT will not be 14# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
@@ -18,20 +18,11 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
18[ 18[
19 AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], 19 AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
20 [AC_LINK_IFELSE( 20 [AC_LINK_IFELSE(
21 [AC_LANG_PROGRAM( 21 [_AC_TYPE_LONG_LONG_SNIPPET],
22 [[long long int ll = 9223372036854775807ll;
23 long long int nll = -9223372036854775807LL;
24 typedef int a[((-9223372036854775807LL < 0
25 && 0 < 9223372036854775807ll)
26 ? 1 : -1)];
27 int i = 63;]],
28 [[long long int llmax = 9223372036854775807ll;
29 return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
30 | (llmax / ll) | (llmax % ll));]])],
31 [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.
32 dnl If cross compiling, assume the bug isn't important, since 23 dnl If cross compiling, assume the bug isn't important, since
33 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.
34 AC_RUN_IFELSE( 25 AC_RUN_IFELSE(
35 [AC_LANG_PROGRAM( 26 [AC_LANG_PROGRAM(
36 [[@%:@include <limits.h> 27 [[@%:@include <limits.h>
37 @%:@ifndef LLONG_MAX 28 @%:@ifndef LLONG_MAX
@@ -60,13 +51,56 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
60 fi 51 fi
61]) 52])
62 53
63# This macro is obsolescent and should go away soon. 54# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
64AC_DEFUN([gl_AC_TYPE_LONG_LONG], 55# This fixes a bug in Autoconf 2.61, but can be removed once we
56# assume 2.62 everywhere.
57
58# Note: If the type 'unsigned long long int' exists but is only 32 bits
59# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
60# will not be defined. In this case you can treat 'unsigned long long int'
61# like 'unsigned long int'.
62
63AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
65[ 64[
66 AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) 65 AC_CACHE_CHECK([for unsigned long long int],
67 ac_cv_type_long_long=$ac_cv_type_long_long_int 66 [ac_cv_type_unsigned_long_long_int],
68 if test $ac_cv_type_long_long = yes; then 67 [AC_LINK_IFELSE(
69 AC_DEFINE(HAVE_LONG_LONG, 1, 68 [_AC_TYPE_LONG_LONG_SNIPPET],
70 [Define if you have the 'long long' type.]) 69 [ac_cv_type_unsigned_long_long_int=yes],
70 [ac_cv_type_unsigned_long_long_int=no])])
71 if test $ac_cv_type_unsigned_long_long_int = yes; then
72 AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
73 [Define to 1 if the system has the type `unsigned long long int'.])
71 fi 74 fi
72]) 75])
76
77# Expands to a C program that can be used to test for simultaneous support
78# of 'long long' and 'unsigned long long'. We don't want to say that
79# 'long long' is available if 'unsigned long long' is not, or vice versa,
80# because too many programs rely on the symmetry between signed and unsigned
81# integer types (excluding 'bool').
82AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
83[
84 AC_LANG_PROGRAM(
85 [[/* For now, do not test the preprocessor; as of 2007 there are too many
86 implementations with broken preprocessors. Perhaps this can
87 be revisited in 2012. In the meantime, code should not expect
88 #if to work with literals wider than 32 bits. */
89 /* Test literals. */
90 long long int ll = 9223372036854775807ll;
91 long long int nll = -9223372036854775807LL;
92 unsigned long long int ull = 18446744073709551615ULL;
93 /* Test constant expressions. */
94 typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
95 ? 1 : -1)];
96 typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
97 ? 1 : -1)];
98 int i = 63;]],
99 [[/* Test availability of runtime routines for shift and division. */
100 long long int llmax = 9223372036854775807ll;
101 unsigned long long int ullmax = 18446744073709551615ull;
102 return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
103 | (llmax / ll) | (llmax % ll)
104 | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
105 | (ullmax / ull) | (ullmax % ull));]])
106])
diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4
new file mode 100644
index 00000000..764f2a9f
--- /dev/null
+++ b/gl/m4/malloc.m4
@@ -0,0 +1,41 @@
1# malloc.m4 serial 8
2dnl Copyright (C) 2007 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_FUNC_MALLOC_POSIX
8# --------------------
9# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it
10# fails), and replace malloc if it is not.
11AC_DEFUN([gl_FUNC_MALLOC_POSIX],
12[
13 AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
14 if test $gl_cv_func_malloc_posix = yes; then
15 HAVE_MALLOC_POSIX=1
16 AC_DEFINE([HAVE_MALLOC_POSIX], 1,
17 [Define if the 'malloc' function is POSIX compliant.])
18 else
19 AC_LIBOBJ([malloc])
20 HAVE_MALLOC_POSIX=0
21 fi
22 AC_SUBST([HAVE_MALLOC_POSIX])
23])
24
25# Test whether malloc, realloc, calloc are POSIX compliant,
26# Set gl_cv_func_malloc_posix to yes or no accordingly.
27AC_DEFUN([gl_CHECK_MALLOC_POSIX],
28[
29 AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant],
30 [gl_cv_func_malloc_posix],
31 [
32 dnl It is too dangerous to try to allocate a large amount of memory:
33 dnl some systems go to their knees when you do that. So assume that
34 dnl all Unix implementations of the function are POSIX compliant.
35 AC_TRY_COMPILE([],
36 [#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
37 choke me
38 #endif
39 ], [gl_cv_func_malloc_posix=yes], [gl_cv_func_malloc_posix=no])
40 ])
41])
diff --git a/gl/m4/mbchar.m4 b/gl/m4/mbchar.m4
deleted file mode 100644
index 5380941b..00000000
--- a/gl/m4/mbchar.m4
+++ /dev/null
@@ -1,14 +0,0 @@
1# mbchar.m4 serial 5
2dnl Copyright (C) 2005-2007 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 autoconf tests required for use of mbchar.m4
8dnl From Bruno Haible.
9
10AC_DEFUN([gl_MBCHAR],
11[
12 AC_REQUIRE([AC_GNU_SOURCE])
13 AC_LIBOBJ([mbchar])
14])
diff --git a/gl/m4/mbiter.m4 b/gl/m4/mbiter.m4
deleted file mode 100644
index 7d51af10..00000000
--- a/gl/m4/mbiter.m4
+++ /dev/null
@@ -1,17 +0,0 @@
1# mbiter.m4 serial 2
2dnl Copyright (C) 2005 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 autoconf tests required for use of mbiter.h
8dnl From Bruno Haible.
9
10AC_DEFUN([gl_MBITER],
11[
12 AC_REQUIRE([AC_TYPE_MBSTATE_T])
13 dnl The following line is that so the user can test HAVE_MBRTOWC before
14 dnl #include "mbiter.h" or "mbuiter.h".
15 AC_REQUIRE([gl_FUNC_MBRTOWC])
16 :
17])
diff --git a/gl/m4/mbrtowc.m4 b/gl/m4/mbrtowc.m4
deleted file mode 100644
index a3bd9114..00000000
--- a/gl/m4/mbrtowc.m4
+++ /dev/null
@@ -1,31 +0,0 @@
1# mbrtowc.m4 serial 8
2dnl Copyright (C) 2001-2002, 2004-2005 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 Paul Eggert
8
9dnl This file can be removed, and gl_FUNC_MBRTOWC replaced with
10dnl AC_FUNC_MBRTOWC, when autoconf 2.60 can be assumed everywhere.
11
12AC_DEFUN([gl_FUNC_MBRTOWC],
13[
14 dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60.
15 AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
16 gl_cv_func_mbrtowc,
17 [AC_LINK_IFELSE(
18 [AC_LANG_PROGRAM(
19 [[#include <wchar.h>]],
20 [[wchar_t wc;
21 char const s[] = "";
22 size_t n = 1;
23 mbstate_t state;
24 return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])],
25 gl_cv_func_mbrtowc=yes,
26 gl_cv_func_mbrtowc=no)])
27 if test $gl_cv_func_mbrtowc = yes; then
28 AC_DEFINE([HAVE_MBRTOWC], 1,
29 [Define to 1 if mbrtowc and mbstate_t are properly declared.])
30 fi
31])
diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4
deleted file mode 100644
index 91b8636e..00000000
--- a/gl/m4/memchr.m4
+++ /dev/null
@@ -1,18 +0,0 @@
1# memchr.m4 serial 4
2dnl Copyright (C) 2002, 2003, 2004 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_MEMCHR],
8[
9 AC_REPLACE_FUNCS(memchr)
10 if test $ac_cv_func_memchr = no; then
11 gl_PREREQ_MEMCHR
12 fi
13])
14
15# Prerequisites of lib/memchr.c.
16AC_DEFUN([gl_PREREQ_MEMCHR], [
17 AC_CHECK_HEADERS(bp-sym.h)
18])
diff --git a/gl/m4/minmax.m4 b/gl/m4/minmax.m4
deleted file mode 100644
index bbd1ba0b..00000000
--- a/gl/m4/minmax.m4
+++ /dev/null
@@ -1,41 +0,0 @@
1# minmax.m4 serial 2
2dnl Copyright (C) 2005 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_PREREQ(2.52)
8
9AC_DEFUN([gl_MINMAX],
10[
11 AC_REQUIRE([gl_PREREQ_MINMAX])
12])
13
14# Prerequisites of lib/minmax.h.
15AC_DEFUN([gl_PREREQ_MINMAX],
16[
17 gl_MINMAX_IN_HEADER([limits.h])
18 gl_MINMAX_IN_HEADER([sys/param.h])
19])
20
21dnl gl_MINMAX_IN_HEADER(HEADER)
22dnl The parameter has to be a literal header name; it cannot be macro,
23dnl nor a shell variable. (Because autoheader collects only AC_DEFINE
24dnl invocations with a literal macro name.)
25AC_DEFUN([gl_MINMAX_IN_HEADER],
26[
27 m4_pushdef([header], AS_TR_SH([$1]))
28 m4_pushdef([HEADER], AS_TR_CPP([$1]))
29 AC_CACHE_CHECK([whether <$1> defines MIN and MAX],
30 [gl_cv_minmax_in_]header,
31 [AC_TRY_COMPILE([#include <$1>
32int x = MIN (42, 17);], [],
33 [gl_cv_minmax_in_]header[=yes],
34 [gl_cv_minmax_in_]header[=no])])
35 if test $gl_cv_minmax_in_[]header = yes; then
36 AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1,
37 [Define to 1 if <$1> defines the MIN and MAX macros.])
38 fi
39 m4_popdef([HEADER])
40 m4_popdef([header])
41])
diff --git a/gl/m4/netinet_in_h.m4 b/gl/m4/netinet_in_h.m4
index d73531a0..096be740 100644
--- a/gl/m4/netinet_in_h.m4
+++ b/gl/m4/netinet_in_h.m4
@@ -1,18 +1,30 @@
1# netinet_in_h.m4 serial 1 1# netinet_in_h.m4 serial 3
2dnl Copyright (C) 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2006-2007 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7dnl Written by Simon Josefsson
8
9AC_DEFUN([gl_HEADER_NETINET_IN], 7AC_DEFUN([gl_HEADER_NETINET_IN],
10[ 8[
11 AC_CHECK_HEADERS_ONCE([netinet/in.h]) 9 AC_CACHE_CHECK([whether <netinet/in.h> is self-contained],
12 if test $ac_cv_header_netinet_in_h = yes; then 10 [gl_cv_header_netinet_in_h_selfcontained],
11 [
12 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netinet/in.h>], [])],
13 [gl_cv_header_netinet_in_h_selfcontained=yes],
14 [gl_cv_header_netinet_in_h_selfcontained=no])
15 ])
16 if test $gl_cv_header_netinet_in_h_selfcontained = yes; then
13 NETINET_IN_H='' 17 NETINET_IN_H=''
14 else 18 else
15 NETINET_IN_H='netinet/in.h' 19 NETINET_IN_H='netinet/in.h'
20 AC_CHECK_HEADERS([netinet/in.h])
21 gl_CHECK_NEXT_HEADERS([netinet/in.h])
22 if test $ac_cv_header_netinet_in_h = yes; then
23 HAVE_NETINET_IN_H=1
24 else
25 HAVE_NETINET_IN_H=0
26 fi
27 AC_SUBST([HAVE_NETINET_IN_H])
16 fi 28 fi
17 AC_SUBST(NETINET_IN_H) 29 AC_SUBST([NETINET_IN_H])
18]) 30])
diff --git a/gl/m4/po.m4 b/gl/m4/po.m4
index 00133ef3..0734762a 100644
--- a/gl/m4/po.m4
+++ b/gl/m4/po.m4
@@ -1,5 +1,5 @@
1# po.m4 serial 13 (gettext-0.15) 1# po.m4 serial 15 (gettext-0.17)
2dnl Copyright (C) 1995-2006 Free Software Foundation, Inc. 2dnl Copyright (C) 1995-2007 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -27,6 +27,10 @@ AC_DEFUN([AM_PO_SUBDIRS],
27 AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake 27 AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
28 AC_REQUIRE([AM_NLS])dnl 28 AC_REQUIRE([AM_NLS])dnl
29 29
30 dnl Release version of the gettext macros. This is used to ensure that
31 dnl the gettext macros and po/Makefile.in.in are in sync.
32 AC_SUBST([GETTEXT_MACRO_VERSION], [0.17])
33
30 dnl Perform the following tests also if --disable-nls has been given, 34 dnl Perform the following tests also if --disable-nls has been given,
31 dnl because they are needed for "make dist" to work. 35 dnl because they are needed for "make dist" to work.
32 36
@@ -84,6 +88,10 @@ changequote([,])dnl
84 test -n "$localedir" || localedir='${datadir}/locale' 88 test -n "$localedir" || localedir='${datadir}/locale'
85 AC_SUBST([localedir]) 89 AC_SUBST([localedir])
86 90
91 dnl Support for AM_XGETTEXT_OPTION.
92 test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS=
93 AC_SUBST([XGETTEXT_EXTRA_OPTIONS])
94
87 AC_CONFIG_COMMANDS([po-directories], [[ 95 AC_CONFIG_COMMANDS([po-directories], [[
88 for ac_file in $CONFIG_FILES; do 96 for ac_file in $CONFIG_FILES; do
89 # Support "outfile[:infile[:infile...]]" 97 # Support "outfile[:infile[:infile...]]"
@@ -426,3 +434,16 @@ EOF
426 fi 434 fi
427 mv "$ac_file.tmp" "$ac_file" 435 mv "$ac_file.tmp" "$ac_file"
428]) 436])
437
438dnl Initializes the accumulator used by AM_XGETTEXT_OPTION.
439AC_DEFUN([AM_XGETTEXT_OPTION_INIT],
440[
441 XGETTEXT_EXTRA_OPTIONS=
442])
443
444dnl Registers an option to be passed to xgettext in the po subdirectory.
445AC_DEFUN([AM_XGETTEXT_OPTION],
446[
447 AC_REQUIRE([AM_XGETTEXT_OPTION_INIT])
448 XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1"
449])
diff --git a/gl/m4/printf-posix.m4 b/gl/m4/printf-posix.m4
index af10170a..14ba6128 100644
--- a/gl/m4/printf-posix.m4
+++ b/gl/m4/printf-posix.m4
@@ -1,5 +1,5 @@
1# printf-posix.m4 serial 2 (gettext-0.13.1) 1# printf-posix.m4 serial 3 (gettext-0.17)
2dnl Copyright (C) 2003 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -28,7 +28,7 @@ int main ()
28}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no, 28}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no,
29 [ 29 [
30 AC_EGREP_CPP(notposix, [ 30 AC_EGREP_CPP(notposix, [
31#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ 31#if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
32 notposix 32 notposix
33#endif 33#endif
34 ], gt_cv_func_printf_posix="guessing no", 34 ], gt_cv_func_printf_posix="guessing no",
diff --git a/gl/m4/regex.m4 b/gl/m4/regex.m4
index 25da645e..7da6efed 100644
--- a/gl/m4/regex.m4
+++ b/gl/m4/regex.m4
@@ -1,4 +1,4 @@
1#serial 42 1#serial 48
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,
4# 2006, 2007 Free Software Foundation, Inc. 4# 2006, 2007 Free Software Foundation, Inc.
@@ -18,9 +18,12 @@ AC_DEFUN([gl_REGEX],
18 18
19 AC_ARG_WITH([included-regex], 19 AC_ARG_WITH([included-regex],
20 [AC_HELP_STRING([--without-included-regex], 20 [AC_HELP_STRING([--without-included-regex],
21 [don't compile regex; this is the default on 21 [don't compile regex; this is the default on 32-bit
22 systems with recent-enough versions of the GNU C 22 systems with recent-enough versions of the GNU C
23 Library (use with caution on other systems)])]) 23 Library (use with caution on other systems).
24 On systems with 64-bit ptrdiff_t and 32-bit int,
25 --with-included-regex is the default, in case
26 regex functions operate on very long strings (>2GB)])])
24 27
25 case $with_included_regex in #( 28 case $with_included_regex in #(
26 yes|no) ac_use_included_regex=$with_included_regex 29 yes|no) ac_use_included_regex=$with_included_regex
@@ -29,8 +32,7 @@ AC_DEFUN([gl_REGEX],
29 # If the system regex support is good enough that it passes the 32 # 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. 33 # 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 34 # If cross compiling, assume the test would fail and use the included
32 # regex.c. The first failing regular expression is from `Spencer ere 35 # regex.c.
33 # test #75' in grep-2.3.
34 AC_CACHE_CHECK([for working re_compile_pattern], 36 AC_CACHE_CHECK([for working re_compile_pattern],
35 [gl_cv_func_re_compile_pattern_working], 37 [gl_cv_func_re_compile_pattern_working],
36 [AC_RUN_IFELSE( 38 [AC_RUN_IFELSE(
@@ -74,68 +76,91 @@ AC_DEFUN([gl_REGEX],
74 } 76 }
75 #endif 77 #endif
76 78
79 /* This test is from glibc bug 3957, reported by Andrew Mackey. */
80 re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE);
81 memset (&regex, 0, sizeof regex);
82 s = re_compile_pattern ("a[^x]b", 6, &regex);
83 if (s)
84 return 1;
85
86 /* This should fail, but succeeds for glibc-2.5. */
87 if (re_search (&regex, "a\nb", 3, 0, 3, &regs) != -1)
88 return 1;
89
90 /* This regular expression is from Spencer ere test number 75
91 in grep-2.3. */
77 re_set_syntax (RE_SYNTAX_POSIX_EGREP); 92 re_set_syntax (RE_SYNTAX_POSIX_EGREP);
78 memset (&regex, 0, sizeof (regex)); 93 memset (&regex, 0, sizeof regex);
79 for (i = 0; i <= UCHAR_MAX; i++) 94 for (i = 0; i <= UCHAR_MAX; i++)
80 folded_chars[i] = i; 95 folded_chars[i] = i;
81 regex.translate = folded_chars; 96 regex.translate = folded_chars;
82 s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, &regex); 97 s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, &regex);
83 /* This should fail with _Invalid character class name_ error. */ 98 /* This should fail with _Invalid character class name_ error. */
84 if (!s) 99 if (!s)
85 exit (1); 100 return 1;
86 101
87 /* This should succeed, but does not for e.g. glibc-2.1.3. */ 102 /* This should succeed, but does not for glibc-2.1.3. */
88 memset (&regex, 0, sizeof (regex)); 103 memset (&regex, 0, sizeof regex);
89 s = re_compile_pattern ("{1", 2, &regex); 104 s = re_compile_pattern ("{1", 2, &regex);
90 105
91 if (s) 106 if (s)
92 exit (1); 107 return 1;
93 108
94 /* The following example is derived from a problem report 109 /* The following example is derived from a problem report
95 against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */ 110 against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */
96 memset (&regex, 0, sizeof (regex)); 111 memset (&regex, 0, sizeof regex);
97 s = re_compile_pattern ("[an\371]*n", 7, &regex); 112 s = re_compile_pattern ("[an\371]*n", 7, &regex);
98 if (s) 113 if (s)
99 exit (1); 114 return 1;
100 115
101 /* This should match, but does not for e.g. glibc-2.2.1. */ 116 /* This should match, but does not for glibc-2.2.1. */
102 if (re_match (&regex, "an", 2, 0, &regs) != 2) 117 if (re_match (&regex, "an", 2, 0, &regs) != 2)
103 exit (1); 118 return 1;
104 119
105 memset (&regex, 0, sizeof (regex)); 120 memset (&regex, 0, sizeof regex);
106 s = re_compile_pattern ("x", 1, &regex); 121 s = re_compile_pattern ("x", 1, &regex);
107 if (s) 122 if (s)
108 exit (1); 123 return 1;
109 124
110 /* The version of regex.c in e.g. GNU libc-2.2.93 did not 125 /* glibc-2.2.93 does not work with a negative RANGE argument. */
111 work with a negative RANGE argument. */
112 if (re_search (&regex, "wxy", 3, 2, -2, &regs) != 1) 126 if (re_search (&regex, "wxy", 3, 2, -2, &regs) != 1)
113 exit (1); 127 return 1;
114 128
115 /* The version of regex.c in older versions of gnulib 129 /* The version of regex.c in older versions of gnulib
116 ignored RE_ICASE. Detect that problem too. */ 130 ignored RE_ICASE. Detect that problem too. */
117 memset (&regex, 0, sizeof (regex));
118 re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE); 131 re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE);
132 memset (&regex, 0, sizeof regex);
119 s = re_compile_pattern ("x", 1, &regex); 133 s = re_compile_pattern ("x", 1, &regex);
120 if (s) 134 if (s)
121 exit (1); 135 return 1;
122 136
123 if (re_search (&regex, "WXY", 3, 0, 3, &regs) < 0) 137 if (re_search (&regex, "WXY", 3, 0, 3, &regs) < 0)
124 exit (1); 138 return 1;
139
140 /* Catch a bug reported by Vin Shelton in
141 http://lists.gnu.org/archive/html/bug-coreutils/2007-06/msg00089.html
142 */
143 re_set_syntax (RE_SYNTAX_POSIX_BASIC
144 & ~RE_CONTEXT_INVALID_DUP
145 & ~RE_NO_EMPTY_RANGES);
146 memset (&regex, 0, sizeof regex);
147 s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, &regex);
148 if (s)
149 return 1;
125 150
126 /* REG_STARTEND was added to glibc on 2004-01-15. 151 /* REG_STARTEND was added to glibc on 2004-01-15.
127 Reject older versions. */ 152 Reject older versions. */
128 if (! REG_STARTEND) 153 if (! REG_STARTEND)
129 exit (1); 154 return 1;
130 155
131 /* Reject hosts whose regoff_t values are too narrow. 156 /* Reject hosts whose regoff_t values are too narrow.
132 These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t 157 These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t
133 and 32-bit int. */ 158 and 32-bit int. */
134 if (sizeof (regoff_t) < sizeof (ptrdiff_t) 159 if (sizeof (regoff_t) < sizeof (ptrdiff_t)
135 || sizeof (regoff_t) < sizeof (ssize_t)) 160 || sizeof (regoff_t) < sizeof (ssize_t))
136 exit (1); 161 return 1;
137 162
138 exit (0);]])], 163 return 0;]])],
139 [gl_cv_func_re_compile_pattern_working=yes], 164 [gl_cv_func_re_compile_pattern_working=yes],
140 [gl_cv_func_re_compile_pattern_working=no], 165 [gl_cv_func_re_compile_pattern_working=no],
141 dnl When crosscompiling, assume it is not working. 166 dnl When crosscompiling, assume it is not working.
@@ -190,9 +215,8 @@ AC_DEFUN([gl_REGEX],
190# Prerequisites of lib/regex.c and lib/regex_internal.c. 215# Prerequisites of lib/regex.c and lib/regex_internal.c.
191AC_DEFUN([gl_PREREQ_REGEX], 216AC_DEFUN([gl_PREREQ_REGEX],
192[ 217[
193 AC_REQUIRE([AC_GNU_SOURCE]) 218 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
194 AC_REQUIRE([AC_C_RESTRICT]) 219 AC_REQUIRE([AC_C_RESTRICT])
195 AC_REQUIRE([AM_LANGINFO_CODESET]) 220 AC_CHECK_FUNCS_ONCE([isblank iswctype mbrtowc wcrtomb wcscoll])
196 AC_CHECK_FUNCS_ONCE([iswctype mbrtowc mempcpy wcrtomb wcscoll])
197 AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>]) 221 AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
198]) 222])
diff --git a/gl/m4/snprintf.m4 b/gl/m4/snprintf.m4
index 432e0375..f21200dc 100644
--- a/gl/m4/snprintf.m4
+++ b/gl/m4/snprintf.m4
@@ -1,13 +1,29 @@
1# snprintf.m4 serial 2 1# snprintf.m4 serial 4
2dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7AC_DEFUN([gl_FUNC_SNPRINTF], 7AC_DEFUN([gl_FUNC_SNPRINTF],
8[ 8[
9 AC_REPLACE_FUNCS(snprintf) 9 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
10 AC_CHECK_DECLS_ONCE(snprintf) 10 AC_CHECK_FUNCS([snprintf])
11 if test $ac_cv_func_snprintf = no; then
12 gl_REPLACE_SNPRINTF
13 fi
14 AC_CHECK_DECLS_ONCE([snprintf])
15 if test $ac_cv_have_decl_snprintf = no; then
16 HAVE_DECL_SNPRINTF=0
17 fi
18])
19
20AC_DEFUN([gl_REPLACE_SNPRINTF],
21[
22 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
23 AC_LIBOBJ([snprintf])
24 if test $ac_cv_func_snprintf = yes; then
25 REPLACE_SNPRINTF=1
26 fi
11 gl_PREREQ_SNPRINTF 27 gl_PREREQ_SNPRINTF
12]) 28])
13 29
diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4
index 5e3765a6..b755757b 100644
--- a/gl/m4/socklen.m4
+++ b/gl/m4/socklen.m4
@@ -1,5 +1,5 @@
1# socklen.m4 serial 4 1# socklen.m4 serial 6
2dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2005, 2006, 2007 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,14 +12,14 @@ dnl types for the argument to getsockopt, getpeername, etc. So we
12dnl have to test to find something that will work. 12dnl have to test to find something that will work.
13 13
14dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find 14dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
15dnl it there first. That file is included by gnulib's socket_.h, which 15dnl it there first. That file is included by gnulib's sys_socket.in.h, which
16dnl all users of this module should include. Cygwin must not include 16dnl all users of this module should include. Cygwin must not include
17dnl ws2tcpip.h. 17dnl ws2tcpip.h.
18AC_DEFUN([gl_TYPE_SOCKLEN_T], 18AC_DEFUN([gl_TYPE_SOCKLEN_T],
19 [AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl 19 [AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl
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_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=
diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4
index 1a4b4a6a..bb6c34fe 100644
--- a/gl/m4/stdint.m4
+++ b/gl/m4/stdint.m4
@@ -1,5 +1,5 @@
1# stdint.m4 serial 22 1# stdint.m4 serial 29
2dnl Copyright (C) 2001-2002, 2004-2007 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2007 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.
@@ -45,32 +45,32 @@ AC_DEFUN([gl_STDINT_H],
45 fi 45 fi
46 AC_SUBST([HAVE_SYS_TYPES_H]) 46 AC_SUBST([HAVE_SYS_TYPES_H])
47 47
48 dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_stdint_h. 48 gl_CHECK_NEXT_HEADERS([stdint.h])
49 if test $ac_cv_header_stdint_h = yes; then 49 if test $ac_cv_header_stdint_h = yes; then
50 gl_ABSOLUTE_HEADER([stdint.h])
51 ABSOLUTE_STDINT_H=\"$gl_cv_absolute_stdint_h\"
52 HAVE_STDINT_H=1 50 HAVE_STDINT_H=1
53 else 51 else
54 ABSOLUTE_STDINT_H=\"no/such/file/stdint.h\"
55 HAVE_STDINT_H=0 52 HAVE_STDINT_H=0
56 fi 53 fi
57 AC_SUBST([ABSOLUTE_STDINT_H])
58 AC_SUBST([HAVE_STDINT_H]) 54 AC_SUBST([HAVE_STDINT_H])
59 55
60 dnl Now see whether we need a substitute <stdint.h>. Use 56 dnl Now see whether we need a substitute <stdint.h>.
61 dnl ABSOLUTE_STDINT_H, not <stdint.h>, so that it also works during
62 dnl a "config.status --recheck" if a stdint.h has been
63 dnl created in the build directory.
64 if test $ac_cv_header_stdint_h = yes; then 57 if test $ac_cv_header_stdint_h = yes; then
65 AC_CACHE_CHECK([whether stdint.h conforms to C99], 58 AC_CACHE_CHECK([whether stdint.h conforms to C99],
66 [gl_cv_header_working_stdint_h], 59 [gl_cv_header_working_stdint_h],
67 [gl_cv_header_working_stdint_h=no 60 [gl_cv_header_working_stdint_h=no
68 AC_COMPILE_IFELSE([ 61 AC_COMPILE_IFELSE([
69 AC_LANG_PROGRAM([[ 62 AC_LANG_PROGRAM([[
70#include <stddef.h>
71#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ 63#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
72#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ 64#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
73#include ABSOLUTE_STDINT_H 65#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
66#include <stdint.h>
67/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */
68#if !(defined WCHAR_MIN && defined WCHAR_MAX)
69#error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>"
70#endif
71]
72gl_STDINT_INCLUDES
73[
74#ifdef INT8_MAX 74#ifdef INT8_MAX
75int8_t a1 = INT8_MAX; 75int8_t a1 = INT8_MAX;
76int8_t a1min = INT8_MIN; 76int8_t a1min = INT8_MIN;
@@ -142,12 +142,32 @@ uintptr_t h = UINTPTR_MAX;
142#endif 142#endif
143intmax_t i = INTMAX_MAX; 143intmax_t i = INTMAX_MAX;
144uintmax_t j = UINTMAX_MAX; 144uintmax_t j = UINTMAX_MAX;
145
146#include <limits.h> /* for CHAR_BIT */
147#define TYPE_MINIMUM(t) \
148 ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
149#define TYPE_MAXIMUM(t) \
150 ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
145struct s { 151struct s {
146 int check_PTRDIFF: PTRDIFF_MIN < 0 && 0 < PTRDIFF_MAX ? 1 : -1; 152 int check_PTRDIFF:
147 int check_SIG_ATOMIC: SIG_ATOMIC_MIN <= 0 && 0 < SIG_ATOMIC_MAX ? 1 : -1; 153 PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t)
148 int check_SIZE: 0 < SIZE_MAX ? 1 : -1; 154 && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t)
149 int check_WCHAR: WCHAR_MIN <= 0 && 0 < WCHAR_MAX ? 1 : -1; 155 ? 1 : -1;
150 int check_WINT: WINT_MIN <= 0 && 0 < WINT_MAX ? 1 : -1; 156 /* Detect bug in FreeBSD 6.0 / ia64. */
157 int check_SIG_ATOMIC:
158 SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t)
159 && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t)
160 ? 1 : -1;
161 int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1;
162 int check_WCHAR:
163 WCHAR_MIN == TYPE_MINIMUM (wchar_t)
164 && WCHAR_MAX == TYPE_MAXIMUM (wchar_t)
165 ? 1 : -1;
166 /* Detect bug in mingw. */
167 int check_WINT:
168 WINT_MIN == TYPE_MINIMUM (wint_t)
169 && WINT_MAX == TYPE_MAXIMUM (wint_t)
170 ? 1 : -1;
151 171
152 /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ 172 /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */
153 int check_UINT8_C: 173 int check_UINT8_C:
@@ -202,6 +222,10 @@ struct s {
202 fi 222 fi
203 AC_SUBST([HAVE_SYS_BITYPES_H]) 223 AC_SUBST([HAVE_SYS_BITYPES_H])
204 224
225 dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
226 dnl character support).
227 AC_CHECK_HEADERS_ONCE([wchar.h])
228
205 gl_STDINT_TYPE_PROPERTIES 229 gl_STDINT_TYPE_PROPERTIES
206 STDINT_H=stdint.h 230 STDINT_H=stdint.h
207 fi 231 fi
@@ -337,14 +361,16 @@ AC_DEFUN([gl_STDINT_INCLUDES],
337 included before <wchar.h>. */ 361 included before <wchar.h>. */
338 #include <stddef.h> 362 #include <stddef.h>
339 #include <signal.h> 363 #include <signal.h>
340 #include <stdio.h> 364 #if HAVE_WCHAR_H
341 #include <time.h> 365 # include <stdio.h>
342 #include <wchar.h> 366 # include <time.h>
367 # include <wchar.h>
368 #endif
343]]) 369]])
344 370
345dnl gl_STDINT_TYPE_PROPERTIES 371dnl gl_STDINT_TYPE_PROPERTIES
346dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t 372dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
347dnl of interest to stdint_.h. 373dnl of interest to stdint.in.h.
348AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], 374AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
349[ 375[
350 gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t], 376 gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4
new file mode 100644
index 00000000..a40d4180
--- /dev/null
+++ b/gl/m4/stdio_h.m4
@@ -0,0 +1,85 @@
1# stdio_h.m4 serial 9
2dnl Copyright (C) 2007 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_STDIO_H],
8[
9 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
10 gl_CHECK_NEXT_HEADERS([stdio.h])
11])
12
13AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
14[
15 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
16 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
17 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
18])
19
20AC_DEFUN([gl_STDIO_H_DEFAULTS],
21[
22 GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX])
23 GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX])
24 GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF])
25 GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX])
26 GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX])
27 GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX])
28 GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF])
29 GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX])
30 GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF])
31 GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN])
32 GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN])
33 GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK])
34 GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO])
35 GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL])
36 GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO])
37 GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH])
38 GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM])
39 GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE])
40 dnl Assume proper GNU behavior unless another module says otherwise.
41 REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF])
42 REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF])
43 REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF])
44 REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF])
45 REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF])
46 HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF])
47 REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF])
48 HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF])
49 REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF])
50 REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF])
51 HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF])
52 REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF])
53 REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN])
54 REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN])
55 HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
56 REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO])
57 REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK])
58 HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO])
59 REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO])
60 REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL])
61 REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH])
62 HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM])
63 HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE])
64 REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE])
65])
66
67dnl Code shared by fseeko and ftello. Determine if large files are supported,
68dnl but stdin does not start as a large file by default.
69AC_DEFUN([gl_STDIN_LARGE_OFFSET],
70 [
71 AC_CACHE_CHECK([whether stdin defaults to large file offsets],
72 [gl_cv_var_stdin_large_offset],
73 [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>],
74[#if defined __SL64 && defined __SCLE /* cygwin */
75 /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
76 fseeko/ftello needlessly fail. This bug was fixed in 1.5.25, and
77 it is easier to do a version check than building a runtime test. */
78# include <cygwin/version.h>
79# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
80 choke me
81# endif
82#endif])],
83 [gl_cv_var_stdin_large_offset=yes],
84 [gl_cv_var_stdin_large_offset=no])])
85])
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4
new file mode 100644
index 00000000..fe4ce122
--- /dev/null
+++ b/gl/m4/stdlib_h.m4
@@ -0,0 +1,42 @@
1# stdlib_h.m4 serial 5
2dnl Copyright (C) 2007 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_STDLIB_H],
8[
9 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
10 gl_CHECK_NEXT_HEADERS([stdlib.h])
11])
12
13AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
14[
15 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
16 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
17 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
18])
19
20AC_DEFUN([gl_STDLIB_H_DEFAULTS],
21[
22 GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX])
23 GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
24 GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX])
25 GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT])
26 GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP])
27 GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP])
28 GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV])
29 GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV])
30 GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV])
31 dnl Assume proper GNU behavior unless another module says otherwise.
32 HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX])
33 HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT])
34 HAVE_MALLOC_POSIX=1; AC_SUBST([HAVE_MALLOC_POSIX])
35 HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
36 HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX])
37 HAVE_SETENV=1; AC_SUBST([HAVE_SETENV])
38 HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV])
39 REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
40 REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
41 VOID_UNSETENV=0; AC_SUBST([VOID_UNSETENV])
42])
diff --git a/gl/m4/strcase.m4 b/gl/m4/strcase.m4
deleted file mode 100644
index ae827907..00000000
--- a/gl/m4/strcase.m4
+++ /dev/null
@@ -1,39 +0,0 @@
1# strcase.m4 serial 4
2dnl Copyright (C) 2002, 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_STRCASE],
8[
9 gl_FUNC_STRCASECMP
10 gl_FUNC_STRNCASECMP
11])
12
13AC_DEFUN([gl_FUNC_STRCASECMP],
14[
15 dnl No known system has a strcasecmp() function that works correctly in
16 dnl multibyte locales. Therefore we use our version always.
17 AC_LIBOBJ(strcasecmp)
18 gl_PREREQ_STRCASECMP
19])
20
21AC_DEFUN([gl_FUNC_STRNCASECMP],
22[
23 AC_REPLACE_FUNCS(strncasecmp)
24 AC_CHECK_DECLS(strncasecmp)
25 if test $ac_cv_func_strncasecmp = no; then
26 gl_PREREQ_STRNCASECMP
27 fi
28])
29
30# Prerequisites of lib/strcasecmp.c.
31AC_DEFUN([gl_PREREQ_STRCASECMP], [
32 AC_REQUIRE([gl_FUNC_MBRTOWC])
33 :
34])
35
36# Prerequisites of lib/strncasecmp.c.
37AC_DEFUN([gl_PREREQ_STRNCASECMP], [
38 :
39])
diff --git a/gl/m4/strdup.m4 b/gl/m4/strdup.m4
index f7786e94..8796e9e0 100644
--- a/gl/m4/strdup.m4
+++ b/gl/m4/strdup.m4
@@ -1,13 +1,20 @@
1# strdup.m4 serial 7 1# strdup.m4 serial 9
2dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 2
3dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software
4dnl Foundation, Inc.
5
3dnl This file is free software; the Free Software Foundation 6dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 7dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 8dnl with or without modifications, as long as this notice is preserved.
6 9
7AC_DEFUN([gl_FUNC_STRDUP], 10AC_DEFUN([gl_FUNC_STRDUP],
8[ 11[
12 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
9 AC_REPLACE_FUNCS(strdup) 13 AC_REPLACE_FUNCS(strdup)
10 AC_CHECK_DECLS_ONCE(strdup) 14 AC_CHECK_DECLS_ONCE(strdup)
15 if test $ac_cv_have_decl_strdup = no; then
16 HAVE_DECL_STRDUP=0
17 fi
11 gl_PREREQ_STRDUP 18 gl_PREREQ_STRDUP
12]) 19])
13 20
diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4
new file mode 100644
index 00000000..eb7d45aa
--- /dev/null
+++ b/gl/m4/strerror.m4
@@ -0,0 +1,47 @@
1# strerror.m4 serial 7
2dnl Copyright (C) 2002, 2007 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_STRERROR],
8[
9 AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE])
10 if test $gl_cv_func_working_strerror = no; then
11 AC_LIBOBJ([strerror])
12 AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR],
13 [Define this to 1 if strerror is broken.])
14 fi
15])
16
17# Like gl_FUNC_STRERROR, except prepare for separate compilation (no AC_LIBOBJ).
18AC_DEFUN([gl_FUNC_STRERROR_SEPARATE],
19[
20 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
21 AC_CACHE_CHECK([for working strerror function],
22 [gl_cv_func_working_strerror],
23 [AC_RUN_IFELSE(
24 [AC_LANG_PROGRAM(
25 [#include <string.h>
26 ],
27 [return !*strerror (-2);])],
28 [gl_cv_func_working_strerror=yes],
29 [gl_cv_func_working_strerror=no],
30 [dnl Assume crossbuild works if it compiles.
31 AC_COMPILE_IFELSE(
32 [AC_LANG_PROGRAM(
33 [#include <string.h>
34 ],
35 [return !*strerror (-2);])],
36 [gl_cv_func_working_strerror=yes],
37 [gl_cv_func_working_strerror=no])])])
38 if test $gl_cv_func_working_strerror = no ; then
39 REPLACE_STRERROR=1
40 gl_PREREQ_STRERROR
41 fi
42])
43
44# Prerequisites of lib/strerror.c.
45AC_DEFUN([gl_PREREQ_STRERROR], [
46 AC_CHECK_DECLS([strerror])
47])
diff --git a/gl/m4/string_h.m4 b/gl/m4/string_h.m4
new file mode 100644
index 00000000..766d7e98
--- /dev/null
+++ b/gl/m4/string_h.m4
@@ -0,0 +1,87 @@
1# Configure a GNU-like replacement for <string.h>.
2
3# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
4# This file is free software; the Free Software Foundation
5# gives unlimited permission to copy and/or distribute it,
6# with or without modifications, as long as this notice is preserved.
7
8# serial 4
9
10# Written by Paul Eggert.
11
12AC_DEFUN([gl_HEADER_STRING_H],
13[
14 dnl Use AC_REQUIRE here, so that the default behavior below is expanded
15 dnl once only, before all statements that occur in other macros.
16 AC_REQUIRE([gl_HEADER_STRING_H_BODY])
17])
18
19AC_DEFUN([gl_HEADER_STRING_H_BODY],
20[
21 AC_REQUIRE([AC_C_RESTRICT])
22 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
23 gl_CHECK_NEXT_HEADERS([string.h])
24])
25
26AC_DEFUN([gl_STRING_MODULE_INDICATOR],
27[
28 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
29 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
30 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
31])
32
33AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
34[
35 GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM])
36 GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY])
37 GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR])
38 GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY])
39 GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY])
40 GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL])
41 GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP])
42 GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP])
43 GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN])
44 GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK])
45 GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP])
46 GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR])
47 GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR])
48 GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R])
49 GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN])
50 GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN])
51 GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR])
52 GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR])
53 GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR])
54 GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP])
55 GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP])
56 GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP])
57 GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR])
58 GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN])
59 GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK])
60 GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN])
61 GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP])
62 GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R])
63 GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR])
64 GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL])
65 dnl Assume proper GNU behavior unless another module says otherwise.
66 HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
67 HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
68 HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR])
69 HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY])
70 HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY])
71 HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL])
72 HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP])
73 HAVE_STRNDUP=1; AC_SUBST([HAVE_STRNDUP])
74 HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP])
75 HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN])
76 HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK])
77 HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP])
78 HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
79 HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
80 HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR])
81 HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL])
82 REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
83 REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
84 REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM])
85 REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR])
86 REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
87])
diff --git a/gl/m4/strndup.m4 b/gl/m4/strndup.m4
index dd5780b6..f7934ef8 100644
--- a/gl/m4/strndup.m4
+++ b/gl/m4/strndup.m4
@@ -1,5 +1,5 @@
1# strndup.m4 serial 11 1# strndup.m4 serial 14
2dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2003, 2005-2007 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,15 +7,19 @@ dnl with or without modifications, as long as this notice is preserved.
7AC_DEFUN([gl_FUNC_STRNDUP], 7AC_DEFUN([gl_FUNC_STRNDUP],
8[ 8[
9 dnl Persuade glibc <string.h> to declare strndup(). 9 dnl Persuade glibc <string.h> to declare strndup().
10 AC_REQUIRE([AC_GNU_SOURCE]) 10 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
11 11
12 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
12 AC_CHECK_DECLS_ONCE([strndup]) 13 AC_CHECK_DECLS_ONCE([strndup])
14 if test $ac_cv_have_decl_strndup = no; then
15 HAVE_DECL_STRNDUP=0
16 fi
13 17
14 # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. 18 # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'.
15 AC_CACHE_CHECK([for working strndup], gl_cv_func_strndup, 19 AC_CACHE_CHECK([for working strndup], gl_cv_func_strndup,
16 [AC_RUN_IFELSE([ 20 [AC_RUN_IFELSE([
17 AC_LANG_PROGRAM([#include <string.h> 21 AC_LANG_PROGRAM([#include <string.h>
18 #include <stdlib.h>], [[ 22 #include <stdlib.h>], [[
19#ifndef HAVE_DECL_STRNDUP 23#ifndef HAVE_DECL_STRNDUP
20 extern char *strndup (const char *, size_t); 24 extern char *strndup (const char *, size_t);
21#endif 25#endif
@@ -39,6 +43,7 @@ AC_DEFUN([gl_FUNC_STRNDUP],
39 AC_DEFINE([HAVE_STRNDUP], 1, 43 AC_DEFINE([HAVE_STRNDUP], 1,
40 [Define if you have the strndup() function and it works.]) 44 [Define if you have the strndup() function and it works.])
41 else 45 else
46 HAVE_STRNDUP=0
42 AC_LIBOBJ([strndup]) 47 AC_LIBOBJ([strndup])
43 gl_PREREQ_STRNDUP 48 gl_PREREQ_STRNDUP
44 fi 49 fi
diff --git a/gl/m4/strnlen.m4 b/gl/m4/strnlen.m4
index 0213a8ae..d8307eda 100644
--- a/gl/m4/strnlen.m4
+++ b/gl/m4/strnlen.m4
@@ -1,5 +1,5 @@
1# strnlen.m4 serial 6 1# strnlen.m4 serial 9
2dnl Copyright (C) 2002-2003, 2005, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2003, 2005-2007 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,11 +7,17 @@ dnl with or without modifications, as long as this notice is preserved.
7AC_DEFUN([gl_FUNC_STRNLEN], 7AC_DEFUN([gl_FUNC_STRNLEN],
8[ 8[
9 dnl Persuade glibc <string.h> to declare strnlen(). 9 dnl Persuade glibc <string.h> to declare strnlen().
10 AC_REQUIRE([AC_GNU_SOURCE]) 10 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
11
12 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
13 AC_CHECK_DECLS_ONCE([strnlen])
14 if test $ac_cv_have_decl_strnlen = no; then
15 HAVE_DECL_STRNLEN=0
16 fi
11 17
12 AC_FUNC_STRNLEN 18 AC_FUNC_STRNLEN
13 if test $ac_cv_func_strnlen_working = no; then 19 if test $ac_cv_func_strnlen_working = no; then
14 # This is necessary because automake-1.6.1 doens't understand 20 # This is necessary because automake-1.6.1 doesn't understand
15 # that the above use of AC_FUNC_STRNLEN means we may have to use 21 # that the above use of AC_FUNC_STRNLEN means we may have to use
16 # lib/strnlen.c. 22 # lib/strnlen.c.
17 #AC_LIBOBJ(strnlen) 23 #AC_LIBOBJ(strnlen)
@@ -22,6 +28,4 @@ AC_DEFUN([gl_FUNC_STRNLEN],
22]) 28])
23 29
24# Prerequisites of lib/strnlen.c. 30# Prerequisites of lib/strnlen.c.
25AC_DEFUN([gl_PREREQ_STRNLEN], [ 31AC_DEFUN([gl_PREREQ_STRNLEN], [:])
26 AC_CHECK_DECLS_ONCE(strnlen)
27])
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4
index d3e45b48..d9659c2d 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 2 1# sys_socket_h.m4 serial 4
2dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2005, 2006, 2007 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,16 +8,44 @@ dnl From Simon Josefsson.
8 8
9AC_DEFUN([gl_HEADER_SYS_SOCKET], 9AC_DEFUN([gl_HEADER_SYS_SOCKET],
10[ 10[
11 AC_CHECK_HEADERS_ONCE([sys/socket.h]) 11 AC_CACHE_CHECK([whether <sys/socket.h> is self-contained],
12 if test $ac_cv_header_sys_socket_h = yes; then 12 [gl_cv_header_sys_socket_h_selfcontained],
13 [
14 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/socket.h>], [])],
15 [gl_cv_header_sys_socket_h_selfcontained=yes],
16 [gl_cv_header_sys_socket_h_selfcontained=no])
17 ])
18 if test $gl_cv_header_sys_socket_h_selfcontained = yes; then
13 SYS_SOCKET_H='' 19 SYS_SOCKET_H=''
14 else 20 else
15 dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
16 dnl the check for those headers unconditional; yet cygwin reports
17 dnl that the headers are present but cannot be compiled (since on
18 dnl cygwin, all socket information should come from sys/socket.h).
19 AC_CHECK_HEADERS([winsock2.h ws2tcpip.h])
20 SYS_SOCKET_H='sys/socket.h' 21 SYS_SOCKET_H='sys/socket.h'
22
23 gl_CHECK_NEXT_HEADERS([sys/socket.h])
24 if test $ac_cv_header_sys_socket_h = yes; then
25 HAVE_SYS_SOCKET_H=1
26 HAVE_WINSOCK2_H=0
27 HAVE_WS2TCPIP_H=0
28 else
29 HAVE_SYS_SOCKET_H=0
30 dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
31 dnl the check for those headers unconditional; yet cygwin reports
32 dnl that the headers are present but cannot be compiled (since on
33 dnl cygwin, all socket information should come from sys/socket.h).
34 AC_CHECK_HEADERS([winsock2.h ws2tcpip.h])
35 if test $ac_cv_header_winsock2_h = yes; then
36 HAVE_WINSOCK2_H=1
37 else
38 HAVE_WINSOCK2_H=0
39 fi
40 if test $ac_cv_header_ws2tcpip_h = yes; then
41 HAVE_WS2TCPIP_H=1
42 else
43 HAVE_WS2TCPIP_H=0
44 fi
45 fi
46 AC_SUBST([HAVE_SYS_SOCKET_H])
47 AC_SUBST([HAVE_WINSOCK2_H])
48 AC_SUBST([HAVE_WS2TCPIP_H])
21 fi 49 fi
22 AC_SUBST(SYS_SOCKET_H) 50 AC_SUBST([SYS_SOCKET_H])
23]) 51])
diff --git a/gl/m4/uintmax_t.m4 b/gl/m4/uintmax_t.m4
index bf83ed74..641c4898 100644
--- a/gl/m4/uintmax_t.m4
+++ b/gl/m4/uintmax_t.m4
@@ -1,5 +1,5 @@
1# uintmax_t.m4 serial 9 1# uintmax_t.m4 serial 10
2dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. 2dnl Copyright (C) 1997-2004, 2007 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,8 +16,8 @@ AC_DEFUN([gl_AC_TYPE_UINTMAX_T],
16 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) 16 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
17 AC_REQUIRE([gl_AC_HEADER_STDINT_H]) 17 AC_REQUIRE([gl_AC_HEADER_STDINT_H])
18 if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then 18 if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
19 AC_REQUIRE([gl_AC_TYPE_UNSIGNED_LONG_LONG]) 19 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
20 test $ac_cv_type_unsigned_long_long = yes \ 20 test $ac_cv_type_unsigned_long_long_int = yes \
21 && ac_type='unsigned long long' \ 21 && ac_type='unsigned long long' \
22 || ac_type='unsigned long' 22 || ac_type='unsigned long'
23 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, 23 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
diff --git a/gl/m4/ulonglong.m4 b/gl/m4/ulonglong.m4
deleted file mode 100644
index 9fae98e3..00000000
--- a/gl/m4/ulonglong.m4
+++ /dev/null
@@ -1,48 +0,0 @@
1# ulonglong.m4 serial 6
2dnl Copyright (C) 1999-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
7dnl From Paul Eggert.
8
9# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
10# This fixes a bug in Autoconf 2.60, but can be removed once we
11# assume 2.61 everywhere.
12
13# Note: If the type 'unsigned long long int' exists but is only 32 bits
14# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
15# will not be defined. In this case you can treat 'unsigned long long int'
16# like 'unsigned long int'.
17
18AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
19[
20 AC_CACHE_CHECK([for unsigned long long int],
21 [ac_cv_type_unsigned_long_long_int],
22 [AC_LINK_IFELSE(
23 [AC_LANG_PROGRAM(
24 [[unsigned long long int ull = 18446744073709551615ULL;
25 typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1
26 ? 1 : -1)];
27 int i = 63;]],
28 [[unsigned long long int ullmax = 18446744073709551615ull;
29 return (ull << 63 | ull >> 63 | ull << i | ull >> i
30 | ullmax / ull | ullmax % ull);]])],
31 [ac_cv_type_unsigned_long_long_int=yes],
32 [ac_cv_type_unsigned_long_long_int=no])])
33 if test $ac_cv_type_unsigned_long_long_int = yes; then
34 AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
35 [Define to 1 if the system has the type `unsigned long long int'.])
36 fi
37])
38
39# This macro is obsolescent and should go away soon.
40AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG],
41[
42 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
43 ac_cv_type_unsigned_long_long=$ac_cv_type_unsigned_long_long_int
44 if test $ac_cv_type_unsigned_long_long = yes; then
45 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
46 [Define if you have the 'unsigned long long' type.])
47 fi
48])
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4
index 9d499dfe..4b8857ca 100644
--- a/gl/m4/unistd_h.m4
+++ b/gl/m4/unistd_h.m4
@@ -1,32 +1,61 @@
1# unistd_h.m4 serial 3 1# unistd_h.m4 serial 10
2dnl Copyright (C) 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2006-2007 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7dnl Written by Simon Josefsson 7dnl Written by Simon Josefsson, Bruno Haible.
8 8
9AC_DEFUN([gl_HEADER_UNISTD], 9AC_DEFUN([gl_UNISTD_H],
10[ 10[
11 AC_CHECK_HEADERS([unistd.h], [ 11 dnl Use AC_REQUIRE here, so that the default behavior below is expanded
12 UNISTD_H='' 12 dnl once only, before all statements that occur in other macros.
13 ], [ 13 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
14 UNISTD_H='unistd.h' 14
15 ]) 15 gl_CHECK_NEXT_HEADERS([unistd.h])
16 AC_SUBST(UNISTD_H)
17 dnl This module decides to build unistd.h if it is missing.
18 dnl The fchdir module decides to build unistd.h if fchdir() is missing.
19 dnl Therefore check for the prerequisites of lib/unistd.h always.
20 gl_PREREQ_UNISTD
21])
22 16
23dnl Prerequisites of lib/unistd.h.
24AC_DEFUN([gl_PREREQ_UNISTD],
25[
26 AC_CHECK_HEADERS_ONCE([unistd.h]) 17 AC_CHECK_HEADERS_ONCE([unistd.h])
27 if test $ac_cv_header_unistd_h = yes; then 18 if test $ac_cv_header_unistd_h = yes; then
28 gl_ABSOLUTE_HEADER([unistd.h]) 19 HAVE_UNISTD_H=1
29 ABSOLUTE_UNISTD_H=\"$gl_cv_absolute_unistd_h\" 20 else
21 HAVE_UNISTD_H=0
30 fi 22 fi
31 AC_SUBST([ABSOLUTE_UNISTD_H]) 23 AC_SUBST([HAVE_UNISTD_H])
24])
25
26AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
27[
28 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
29 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
30 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
31])
32
33AC_DEFUN([gl_UNISTD_H_DEFAULTS],
34[
35 GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN])
36 GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2])
37 GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR])
38 GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE])
39 GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD])
40 GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R])
41 GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE])
42 GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN])
43 GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK])
44 GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK])
45 GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP])
46 dnl Assume proper GNU behavior unless another module says otherwise.
47 HAVE_DUP2=1; AC_SUBST([HAVE_DUP2])
48 HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE])
49 HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE])
50 HAVE_READLINK=1; AC_SUBST([HAVE_READLINK])
51 HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP])
52 HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
53 HAVE_OS_H=0; AC_SUBST([HAVE_OS_H])
54 HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H])
55 REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN])
56 REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR])
57 REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])
58 REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
59 REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN])
60 REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK])
32]) 61])
diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4
index 72c9a13e..c4d3f4fa 100644
--- a/gl/m4/vasnprintf.m4
+++ b/gl/m4/vasnprintf.m4
@@ -1,5 +1,5 @@
1# vasnprintf.m4 serial 7 1# vasnprintf.m4 serial 24
2dnl Copyright (C) 2002-2004, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2004, 2006-2008 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,23 +7,33 @@ dnl with or without modifications, as long as this notice is preserved.
7AC_DEFUN([gl_FUNC_VASNPRINTF], 7AC_DEFUN([gl_FUNC_VASNPRINTF],
8[ 8[
9 AC_REQUIRE([gl_EOVERFLOW]) 9 AC_REQUIRE([gl_EOVERFLOW])
10 AC_REPLACE_FUNCS(vasnprintf) 10 AC_CHECK_FUNCS_ONCE([vasnprintf])
11 if test $ac_cv_func_vasnprintf = no; then 11 if test $ac_cv_func_vasnprintf = no; then
12 AC_LIBOBJ(printf-args) 12 gl_REPLACE_VASNPRINTF
13 AC_LIBOBJ(printf-parse)
14 AC_LIBOBJ(asnprintf)
15 gl_PREREQ_PRINTF_ARGS
16 gl_PREREQ_PRINTF_PARSE
17 gl_PREREQ_VASNPRINTF
18 gl_PREREQ_ASNPRINTF
19 fi 13 fi
20]) 14])
21 15
16AC_DEFUN([gl_REPLACE_VASNPRINTF],
17[
18 AC_CHECK_FUNCS_ONCE([vasnprintf])
19 AC_LIBOBJ([vasnprintf])
20 AC_LIBOBJ([printf-args])
21 AC_LIBOBJ([printf-parse])
22 AC_LIBOBJ([asnprintf])
23 if test $ac_cv_func_vasnprintf = yes; then
24 AC_DEFINE([REPLACE_VASNPRINTF], 1,
25 [Define if vasnprintf exists but is overridden by gnulib.])
26 fi
27 gl_PREREQ_PRINTF_ARGS
28 gl_PREREQ_PRINTF_PARSE
29 gl_PREREQ_VASNPRINTF
30 gl_PREREQ_ASNPRINTF
31])
32
22# Prequisites of lib/printf-args.h, lib/printf-args.c. 33# Prequisites of lib/printf-args.h, lib/printf-args.c.
23AC_DEFUN([gl_PREREQ_PRINTF_ARGS], 34AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
24[ 35[
25 AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) 36 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
26 AC_REQUIRE([gt_TYPE_LONGDOUBLE])
27 AC_REQUIRE([gt_TYPE_WCHAR_T]) 37 AC_REQUIRE([gt_TYPE_WCHAR_T])
28 AC_REQUIRE([gt_TYPE_WINT_T]) 38 AC_REQUIRE([gt_TYPE_WINT_T])
29]) 39])
@@ -32,11 +42,13 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
32AC_DEFUN([gl_PREREQ_PRINTF_PARSE], 42AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
33[ 43[
34 AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) 44 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
35 AC_REQUIRE([gt_TYPE_LONGDOUBLE])
36 AC_REQUIRE([gt_TYPE_WCHAR_T]) 45 AC_REQUIRE([gt_TYPE_WCHAR_T])
37 AC_REQUIRE([gt_TYPE_WINT_T]) 46 AC_REQUIRE([gt_TYPE_WINT_T])
38 AC_REQUIRE([AC_TYPE_SIZE_T]) 47 AC_REQUIRE([AC_TYPE_SIZE_T])
39 AC_CHECK_TYPES(ptrdiff_t) 48 AC_CHECK_TYPE([ptrdiff_t], ,
49 [AC_DEFINE([ptrdiff_t], [long],
50 [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
51 ])
40 AC_REQUIRE([gt_AC_TYPE_INTMAX_T]) 52 AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
41]) 53])
42 54
@@ -45,10 +57,202 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF],
45[ 57[
46 AC_REQUIRE([AC_FUNC_ALLOCA]) 58 AC_REQUIRE([AC_FUNC_ALLOCA])
47 AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) 59 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
48 AC_REQUIRE([gt_TYPE_LONGDOUBLE])
49 AC_REQUIRE([gt_TYPE_WCHAR_T]) 60 AC_REQUIRE([gt_TYPE_WCHAR_T])
50 AC_REQUIRE([gt_TYPE_WINT_T]) 61 AC_REQUIRE([gt_TYPE_WINT_T])
51 AC_CHECK_FUNCS(snprintf wcslen) 62 AC_CHECK_FUNCS(snprintf wcslen)
63 dnl Use the _snprintf function only if it is declared (because on NetBSD it
64 dnl is defined as a weak alias of snprintf; we prefer to use the latter).
65 AC_CHECK_DECLS([_snprintf], , , [#include <stdio.h>])
66])
67
68# Extra prerequisites of lib/vasnprintf.c for supporting 'long double'
69# arguments.
70AC_DEFUN([gl_PREREQ_VASNPRINTF_LONG_DOUBLE],
71[
72 AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
73 case "$gl_cv_func_printf_long_double" in
74 *yes)
75 ;;
76 *)
77 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
78 [Define if the vasnprintf implementation needs special code for
79 'long double' arguments.])
80 ;;
81 esac
82])
83
84# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double'
85# arguments.
86AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE],
87[
88 AC_REQUIRE([gl_PRINTF_INFINITE])
89 case "$gl_cv_func_printf_infinite" in
90 *yes)
91 ;;
92 *)
93 AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], 1,
94 [Define if the vasnprintf implementation needs special code for
95 infinite 'double' arguments.])
96 ;;
97 esac
98])
99
100# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double'
101# arguments.
102AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE],
103[
104 AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
105 dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if
106 dnl NEED_PRINTF_LONG_DOUBLE is already set.
107 AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE])
108 case "$gl_cv_func_printf_long_double" in
109 *yes)
110 case "$gl_cv_func_printf_infinite_long_double" in
111 *yes)
112 ;;
113 *)
114 AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], 1,
115 [Define if the vasnprintf implementation needs special code for
116 infinite 'long double' arguments.])
117 ;;
118 esac
119 ;;
120 esac
121])
122
123# Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive.
124AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A],
125[
126 AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
127 case "$gl_cv_func_printf_directive_a" in
128 *yes)
129 ;;
130 *)
131 AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1,
132 [Define if the vasnprintf implementation needs special code for
133 the 'a' and 'A' directives.])
134 AC_CHECK_FUNCS([nl_langinfo])
135 ;;
136 esac
137])
138
139# Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive.
140AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F],
141[
142 AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
143 case "$gl_cv_func_printf_directive_f" in
144 *yes)
145 ;;
146 *)
147 AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], 1,
148 [Define if the vasnprintf implementation needs special code for
149 the 'F' directive.])
150 ;;
151 esac
152])
153
154# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
155AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
156[
157 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
158 case "$gl_cv_func_printf_flag_grouping" in
159 *yes)
160 ;;
161 *)
162 AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], 1,
163 [Define if the vasnprintf implementation needs special code for the
164 ' flag.])
165 ;;
166 esac
167])
168
169# Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag.
170AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST],
171[
172 AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
173 case "$gl_cv_func_printf_flag_leftadjust" in
174 *yes)
175 ;;
176 *)
177 AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], 1,
178 [Define if the vasnprintf implementation needs special code for the
179 '-' flag.])
180 ;;
181 esac
182])
183
184# Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
185AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
186[
187 AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
188 case "$gl_cv_func_printf_flag_zero" in
189 *yes)
190 ;;
191 *)
192 AC_DEFINE([NEED_PRINTF_FLAG_ZERO], 1,
193 [Define if the vasnprintf implementation needs special code for the
194 0 flag.])
195 ;;
196 esac
197])
198
199# Extra prerequisites of lib/vasnprintf.c for supporting large precisions.
200AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION],
201[
202 AC_REQUIRE([gl_PRINTF_PRECISION])
203 case "$gl_cv_func_printf_precision" in
204 *yes)
205 ;;
206 *)
207 AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], 1,
208 [Define if the vasnprintf implementation needs special code for
209 supporting large precisions without arbitrary bounds.])
210 AC_DEFINE([NEED_PRINTF_DOUBLE], 1,
211 [Define if the vasnprintf implementation needs special code for
212 'double' arguments.])
213 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
214 [Define if the vasnprintf implementation needs special code for
215 'long double' arguments.])
216 ;;
217 esac
218])
219
220# Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory
221# conditions.
222AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM],
223[
224 AC_REQUIRE([gl_PRINTF_ENOMEM])
225 case "$gl_cv_func_printf_enomem" in
226 *yes)
227 ;;
228 *)
229 AC_DEFINE([NEED_PRINTF_ENOMEM], 1,
230 [Define if the vasnprintf implementation needs special code for
231 surviving out-of-memory conditions.])
232 AC_DEFINE([NEED_PRINTF_DOUBLE], 1,
233 [Define if the vasnprintf implementation needs special code for
234 'double' arguments.])
235 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
236 [Define if the vasnprintf implementation needs special code for
237 'long double' arguments.])
238 ;;
239 esac
240])
241
242# Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance.
243AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
244[
245 AC_REQUIRE([gl_PREREQ_VASNPRINTF])
246 gl_PREREQ_VASNPRINTF_LONG_DOUBLE
247 gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
248 gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
249 gl_PREREQ_VASNPRINTF_DIRECTIVE_A
250 gl_PREREQ_VASNPRINTF_DIRECTIVE_F
251 gl_PREREQ_VASNPRINTF_FLAG_GROUPING
252 gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
253 gl_PREREQ_VASNPRINTF_FLAG_ZERO
254 gl_PREREQ_VASNPRINTF_PRECISION
255 gl_PREREQ_VASNPRINTF_ENOMEM
52]) 256])
53 257
54# Prerequisites of lib/asnprintf.c. 258# Prerequisites of lib/asnprintf.c.
diff --git a/gl/m4/vasprintf.m4 b/gl/m4/vasprintf.m4
index 18ca6327..074b03cf 100644
--- a/gl/m4/vasprintf.m4
+++ b/gl/m4/vasprintf.m4
@@ -1,25 +1,37 @@
1# vasprintf.m4 serial 2 1# vasprintf.m4 serial 6
2dnl Copyright (C) 2002-2003, 2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2003, 2006-2007 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7AC_DEFUN([gl_FUNC_VASPRINTF], 7AC_DEFUN([gl_FUNC_VASPRINTF],
8[ 8[
9 AC_REPLACE_FUNCS(vasprintf) 9 AC_CHECK_FUNCS([vasprintf])
10 if test $ac_cv_func_vasprintf = no; then 10 if test $ac_cv_func_vasprintf = no; then
11 AC_LIBOBJ(asprintf) 11 gl_REPLACE_VASPRINTF
12 gl_PREREQ_VASPRINTF_H
13 gl_PREREQ_VASPRINTF
14 gl_PREREQ_ASPRINTF
15 fi 12 fi
16]) 13])
17 14
18# Prerequisites of lib/vasprintf.h. 15AC_DEFUN([gl_REPLACE_VASPRINTF],
16[
17 AC_LIBOBJ([vasprintf])
18 AC_LIBOBJ([asprintf])
19 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
20 if test $ac_cv_func_vasprintf = yes; then
21 REPLACE_VASPRINTF=1
22 else
23 HAVE_VASPRINTF=0
24 fi
25 gl_PREREQ_VASPRINTF_H
26 gl_PREREQ_VASPRINTF
27 gl_PREREQ_ASPRINTF
28])
29
30# Prerequisites of the vasprintf portion of lib/stdio.h.
19AC_DEFUN([gl_PREREQ_VASPRINTF_H], 31AC_DEFUN([gl_PREREQ_VASPRINTF_H],
20[ 32[
21 dnl Persuade glibc <stdio.h> to declare asprintf() and vasprintf(). 33 dnl Persuade glibc <stdio.h> to declare asprintf() and vasprintf().
22 AC_REQUIRE([AC_GNU_SOURCE]) 34 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
23]) 35])
24 36
25# Prerequisites of lib/vasprintf.c. 37# Prerequisites of lib/vasprintf.c.
diff --git a/gl/m4/vsnprintf.m4 b/gl/m4/vsnprintf.m4
index cb8a9b18..accc79f8 100644
--- a/gl/m4/vsnprintf.m4
+++ b/gl/m4/vsnprintf.m4
@@ -1,13 +1,29 @@
1# vsnprintf.m4 serial 2 1# vsnprintf.m4 serial 4
2dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7AC_DEFUN([gl_FUNC_VSNPRINTF], 7AC_DEFUN([gl_FUNC_VSNPRINTF],
8[ 8[
9 AC_REPLACE_FUNCS(vsnprintf) 9 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
10 AC_CHECK_DECLS_ONCE(vsnprintf) 10 AC_CHECK_FUNCS([vsnprintf])
11 if test $ac_cv_func_vsnprintf = no; then
12 gl_REPLACE_VSNPRINTF
13 fi
14 AC_CHECK_DECLS_ONCE([vsnprintf])
15 if test $ac_cv_have_decl_vsnprintf = no; then
16 HAVE_DECL_VSNPRINTF=0
17 fi
18])
19
20AC_DEFUN([gl_REPLACE_VSNPRINTF],
21[
22 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
23 AC_LIBOBJ([vsnprintf])
24 if test $ac_cv_func_vsnprintf = yes; then
25 REPLACE_VSNPRINTF=1
26 fi
11 gl_PREREQ_VSNPRINTF 27 gl_PREREQ_VSNPRINTF
12]) 28])
13 29
diff --git a/gl/m4/wchar.m4 b/gl/m4/wchar.m4
index 068f22d3..70b1248f 100644
--- a/gl/m4/wchar.m4
+++ b/gl/m4/wchar.m4
@@ -7,23 +7,48 @@ dnl 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 1 10# wchar.m4 serial 4
11 11
12AC_DEFUN([gl_WCHAR_H], 12AC_DEFUN([gl_WCHAR_H],
13[ 13[
14 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
14 AC_CACHE_CHECK([whether <wchar.h> is standalone], 15 AC_CACHE_CHECK([whether <wchar.h> is standalone],
15 [gl_cv_header_wchar_h_standalone], 16 [gl_cv_header_wchar_h_standalone],
16 [AC_COMPILE_IFELSE([[#include <wchar.h> 17 [AC_COMPILE_IFELSE([[#include <wchar.h>
17wchar_t w;]], 18wchar_t w;]],
18 [gl_cv_header_wchar_h_standalone=yes], 19 [gl_cv_header_wchar_h_standalone=yes],
19 [gl_cv_header_wchar_h_standalone=no])]) 20 [gl_cv_header_wchar_h_standalone=no])])
20 if test $gl_cv_header_wchar_h_standalone = yes; then 21 if test $gl_cv_header_wchar_h_standalone != yes; then
21 WCHAR_H=
22 else
23 gl_ABSOLUTE_HEADER([wchar.h])
24 ABSOLUTE_WCHAR_H=\"$gl_cv_absolute_wchar_h\"
25 WCHAR_H=wchar.h 22 WCHAR_H=wchar.h
26 fi 23 fi
27 AC_SUBST([ABSOLUTE_WCHAR_H]) 24
25 dnl Prepare for creating substitute <wchar.h>.
26 dnl Do it always: WCHAR_H may be empty here but can be set later.
27 dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
28 dnl character support).
29 AC_CHECK_HEADERS_ONCE([wchar.h])
30 if test $ac_cv_header_wchar_h = yes; then
31 HAVE_WCHAR_H=1
32 else
33 HAVE_WCHAR_H=0
34 fi
35 AC_SUBST([HAVE_WCHAR_H])
36 gl_CHECK_NEXT_HEADERS([wchar.h])
37])
38
39AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
40[
41 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
42 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
43 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
44])
45
46AC_DEFUN([gl_WCHAR_H_DEFAULTS],
47[
48 GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
49 dnl Assume proper GNU behavior unless another module says otherwise.
50 HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
51 REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
52 WCHAR_H=
28 AC_SUBST([WCHAR_H]) 53 AC_SUBST([WCHAR_H])
29]) 54])
diff --git a/gl/m4/wctype.m4 b/gl/m4/wctype.m4
index 62994c62..7483c4fe 100644
--- a/gl/m4/wctype.m4
+++ b/gl/m4/wctype.m4
@@ -10,6 +10,12 @@ dnl Written by Paul Eggert.
10AC_DEFUN([gl_WCTYPE_H], 10AC_DEFUN([gl_WCTYPE_H],
11[ 11[
12 AC_CHECK_FUNCS_ONCE([iswcntrl]) 12 AC_CHECK_FUNCS_ONCE([iswcntrl])
13 if test $ac_cv_func_iswcntrl = yes; then
14 HAVE_ISWCNTRL=1
15 else
16 HAVE_ISWCNTRL=0
17 fi
18 AC_SUBST([HAVE_ISWCNTRL])
13 AC_CHECK_HEADERS_ONCE([wctype.h]) 19 AC_CHECK_HEADERS_ONCE([wctype.h])
14 AC_REQUIRE([AC_C_INLINE]) 20 AC_REQUIRE([AC_C_INLINE])
15 21
@@ -23,19 +29,16 @@ AC_DEFUN([gl_WCTYPE_H],
23 29
24 WCTYPE_H=wctype.h 30 WCTYPE_H=wctype.h
25 if test $ac_cv_header_wctype_h = yes; then 31 if test $ac_cv_header_wctype_h = yes; then
26 if test "$ac_cv_func_iswcntrl" = yes; then 32 if test $ac_cv_func_iswcntrl = yes; then
27 WCTYPE_H= 33 WCTYPE_H=
28 fi 34 fi
29 dnl Compute ABSOLUTE_WCTYPE_H even if WCTYPE_H is empty, 35 dnl Compute NEXT_WCTYPE_H even if WCTYPE_H is empty,
30 dnl for the benefit of builds from non-distclean directories. 36 dnl for the benefit of builds from non-distclean directories.
31 gl_ABSOLUTE_HEADER([wctype.h]) 37 gl_CHECK_NEXT_HEADERS([wctype.h])
32 ABSOLUTE_WCTYPE_H=\"$gl_cv_absolute_wctype_h\"
33 HAVE_WCTYPE_H=1 38 HAVE_WCTYPE_H=1
34 else 39 else
35 ABSOLUTE_WCTYPE_H=\"no/such/file/wctype.h\"
36 HAVE_WCTYPE_H=0 40 HAVE_WCTYPE_H=0
37 fi 41 fi
38 AC_SUBST([ABSOLUTE_WCTYPE_H])
39 AC_SUBST([HAVE_WCTYPE_H]) 42 AC_SUBST([HAVE_WCTYPE_H])
40 AC_SUBST([WCTYPE_H]) 43 AC_SUBST([WCTYPE_H])
41]) 44])
diff --git a/gl/m4/wcwidth.m4 b/gl/m4/wcwidth.m4
deleted file mode 100644
index b4834991..00000000
--- a/gl/m4/wcwidth.m4
+++ /dev/null
@@ -1,30 +0,0 @@
1# wcwidth.m4 serial 8
2dnl Copyright (C) 2006, 2007 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_WCWIDTH],
8[
9 dnl Persuade glibc <wchar.h> to declare wcwidth().
10 AC_REQUIRE([AC_GNU_SOURCE])
11
12 AC_REQUIRE([AC_C_INLINE])
13 AC_REQUIRE([gt_TYPE_WCHAR_T])
14 AC_REQUIRE([gt_TYPE_WINT_T])
15
16 AC_CHECK_HEADERS_ONCE([wchar.h])
17 AC_CHECK_FUNCS_ONCE([wcwidth])
18
19 AC_CHECK_DECLS([wcwidth], [], [], [
20/* AIX 3.2.5 declares wcwidth in <string.h>. */
21#include <string.h>
22/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
23 <wchar.h>.
24 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
25 before <wchar.h>. */
26#include <stddef.h>
27#include <stdio.h>
28#include <time.h>
29#include <wchar.h>
30])])
diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4
index 3706c047..af5ed936 100644
--- a/gl/m4/wint_t.m4
+++ b/gl/m4/wint_t.m4
@@ -1,4 +1,4 @@
1# wint_t.m4 serial 2 (gettext-0.12) 1# wint_t.m4 serial 2 (gettext-0.17)
2dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007 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,