aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2011-04-26 12:29:47 -0700
committerPaul Eggert2011-04-26 12:29:47 -0700
commitb6f5355a9e65892e4af245fbd9789cd9a9a5ed6b (patch)
tree5bd7d3ee0cc23ffcae7c592a3ecef6850cbc3d86
parentaa0b008761ca665ee64bc65a7208478a6bb69fe2 (diff)
downloademacs-b6f5355a9e65892e4af245fbd9789cd9a9a5ed6b.tar.gz
emacs-b6f5355a9e65892e4af245fbd9789cd9a9a5ed6b.zip
Update from gnulib.
-rw-r--r--lib/gnulib.mk17
-rw-r--r--m4/gl-comp.m410
-rw-r--r--m4/inttypes.m4109
-rw-r--r--m4/strtoumax.m41
4 files changed, 128 insertions, 9 deletions
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index d79f3c2b571..f686137d38d 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -174,7 +174,7 @@ EXTRA_DIST += intprops.h
174 174
175## end gnulib module intprops 175## end gnulib module intprops
176 176
177## begin gnulib module inttypes-h 177## begin gnulib module inttypes-incomplete
178 178
179BUILT_SOURCES += inttypes.h 179BUILT_SOURCES += inttypes.h
180 180
@@ -214,7 +214,7 @@ MOSTLYCLEANFILES += inttypes.h inttypes.h-t
214 214
215EXTRA_DIST += inttypes.in.h 215EXTRA_DIST += inttypes.in.h
216 216
217## end gnulib module inttypes-h 217## end gnulib module inttypes-incomplete
218 218
219## begin gnulib module lstat 219## begin gnulib module lstat
220 220
@@ -574,12 +574,21 @@ EXTRA_libgnu_a_SOURCES += strftime.c
574 574
575## end gnulib module strftime 575## end gnulib module strftime
576 576
577## begin gnulib module strtoull
578
579
580EXTRA_DIST += strtol.c strtoul.c strtoull.c
581
582EXTRA_libgnu_a_SOURCES += strtol.c strtoul.c strtoull.c
583
584## end gnulib module strtoull
585
577## begin gnulib module strtoumax 586## begin gnulib module strtoumax
578 587
579 588
580EXTRA_DIST += strtoimax.c strtol.c strtoul.c strtoull.c strtoumax.c 589EXTRA_DIST += strtoimax.c strtoumax.c
581 590
582EXTRA_libgnu_a_SOURCES += strtoimax.c strtol.c strtoul.c strtoull.c strtoumax.c 591EXTRA_libgnu_a_SOURCES += strtoimax.c strtoumax.c
583 592
584## end gnulib module strtoumax 593## end gnulib module strtoumax
585 594
diff --git a/m4/gl-comp.m4 b/m4/gl-comp.m4
index 16f62236e27..3b7bdfc5673 100644
--- a/m4/gl-comp.m4
+++ b/m4/gl-comp.m4
@@ -43,7 +43,7 @@ AC_DEFUN([gl_EARLY],
43 # Code from module ignore-value: 43 # Code from module ignore-value:
44 # Code from module include_next: 44 # Code from module include_next:
45 # Code from module intprops: 45 # Code from module intprops:
46 # Code from module inttypes-h: 46 # Code from module inttypes-incomplete:
47 # Code from module lstat: 47 # Code from module lstat:
48 # Code from module mktime: 48 # Code from module mktime:
49 # Code from module multiarch: 49 # Code from module multiarch:
@@ -57,6 +57,7 @@ AC_DEFUN([gl_EARLY],
57 # Code from module stdio: 57 # Code from module stdio:
58 # Code from module stdlib: 58 # Code from module stdlib:
59 # Code from module strftime: 59 # Code from module strftime:
60 # Code from module strtoull:
60 # Code from module strtoumax: 61 # Code from module strtoumax:
61 # Code from module symlink: 62 # Code from module symlink:
62 # Code from module sys_stat: 63 # Code from module sys_stat:
@@ -111,8 +112,8 @@ AC_DEFUN([gl_INIT],
111 AC_REQUIRE([AC_C_INLINE]) 112 AC_REQUIRE([AC_C_INLINE])
112 # Code from module include_next: 113 # Code from module include_next:
113 # Code from module intprops: 114 # Code from module intprops:
114 # Code from module inttypes-h: 115 # Code from module inttypes-incomplete:
115 gl_INTTYPES_H 116 gl_INTTYPES_INCOMPLETE
116 # Code from module lstat: 117 # Code from module lstat:
117 gl_FUNC_LSTAT 118 gl_FUNC_LSTAT
118 gl_SYS_STAT_MODULE_INDICATOR([lstat]) 119 gl_SYS_STAT_MODULE_INDICATOR([lstat])
@@ -143,6 +144,9 @@ AC_DEFUN([gl_INIT],
143 gl_STDLIB_H 144 gl_STDLIB_H
144 # Code from module strftime: 145 # Code from module strftime:
145 gl_FUNC_GNU_STRFTIME 146 gl_FUNC_GNU_STRFTIME
147 # Code from module strtoull:
148 gl_FUNC_STRTOULL
149 gl_STDLIB_MODULE_INDICATOR([strtoull])
146 # Code from module strtoumax: 150 # Code from module strtoumax:
147 gl_FUNC_STRTOUMAX 151 gl_FUNC_STRTOUMAX
148 gl_INTTYPES_MODULE_INDICATOR([strtoumax]) 152 gl_INTTYPES_MODULE_INDICATOR([strtoumax])
diff --git a/m4/inttypes.m4 b/m4/inttypes.m4
index 920f72db755..1e81990bda2 100644
--- a/m4/inttypes.m4
+++ b/m4/inttypes.m4
@@ -1,4 +1,4 @@
1# inttypes.m4 serial 19 1# inttypes.m4 serial 23
2dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. 2dnl Copyright (C) 2006-2011 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,
@@ -9,6 +9,12 @@ dnl Test whether <inttypes.h> is supported or must be substituted.
9 9
10AC_DEFUN([gl_INTTYPES_H], 10AC_DEFUN([gl_INTTYPES_H],
11[ 11[
12 AC_REQUIRE([gl_INTTYPES_INCOMPLETE])
13 gl_INTTYPES_PRI_SCN
14])
15
16AC_DEFUN([gl_INTTYPES_INCOMPLETE],
17[
12 AC_REQUIRE([gl_STDINT_H]) 18 AC_REQUIRE([gl_STDINT_H])
13 AC_CHECK_HEADERS_ONCE([inttypes.h]) 19 AC_CHECK_HEADERS_ONCE([inttypes.h])
14 20
@@ -40,6 +46,105 @@ AC_DEFUN([gl_INTTYPES_H],
40 ]], [imaxabs imaxdiv strtoimax strtoumax]) 46 ]], [imaxabs imaxdiv strtoimax strtoumax])
41]) 47])
42 48
49# Ensure that the PRI* and SCN* macros are defined appropriately.
50AC_DEFUN([gl_INTTYPES_PRI_SCN],
51[
52 AC_REQUIRE([gt_INTTYPES_PRI])
53
54 PRIPTR_PREFIX=
55 if test -n "$STDINT_H"; then
56 dnl Using the gnulib <stdint.h>. It always defines intptr_t to 'long'.
57 PRIPTR_PREFIX='"l"'
58 else
59 dnl Using the system's <stdint.h>.
60 for glpfx in '' l ll I64; do
61 case $glpfx in
62 '') gltype1='int';;
63 l) gltype1='long int';;
64 ll) gltype1='long long int';;
65 I64) gltype1='__int64';;
66 esac
67 AC_COMPILE_IFELSE(
68 [AC_LANG_PROGRAM([[#include <stdint.h>
69 extern intptr_t foo;
70 extern $gltype1 foo;]])],
71 [PRIPTR_PREFIX='"'$glpfx'"'])
72 test -n "$PRIPTR_PREFIX" && break
73 done
74 fi
75 AC_SUBST([PRIPTR_PREFIX])
76
77 gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
78 [INT32_MAX_LT_INTMAX_MAX],
79 [defined INT32_MAX && defined INTMAX_MAX],
80 [INT32_MAX < INTMAX_MAX],
81 [sizeof (int) < sizeof (long long int)])
82 if test $APPLE_UNIVERSAL_BUILD = 0; then
83 gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
84 [INT64_MAX_EQ_LONG_MAX],
85 [defined INT64_MAX],
86 [INT64_MAX == LONG_MAX],
87 [sizeof (long long int) == sizeof (long int)])
88 else
89 INT64_MAX_EQ_LONG_MAX=-1
90 fi
91 gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
92 [UINT32_MAX_LT_UINTMAX_MAX],
93 [defined UINT32_MAX && defined UINTMAX_MAX],
94 [UINT32_MAX < UINTMAX_MAX],
95 [sizeof (unsigned int) < sizeof (unsigned long long int)])
96 if test $APPLE_UNIVERSAL_BUILD = 0; then
97 gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
98 [UINT64_MAX_EQ_ULONG_MAX],
99 [defined UINT64_MAX],
100 [UINT64_MAX == ULONG_MAX],
101 [sizeof (unsigned long long int) == sizeof (unsigned long int)])
102 else
103 UINT64_MAX_EQ_ULONG_MAX=-1
104 fi
105])
106
107# Define the symbol $1 to be 1 if the condition is true, 0 otherwise.
108# If $2 is true, the condition is $3; otherwise if long long int is supported
109# approximate the condition with $4; otherwise, assume the condition is false.
110# The condition should work on all C99 platforms; the approximations should be
111# good enough to work on all practical pre-C99 platforms.
112# $2 is evaluated by the C preprocessor, $3 and $4 as compile-time constants.
113AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION],
114[
115 AC_CACHE_CHECK([whether $3],
116 [gl_cv_test_$1],
117 [AC_COMPILE_IFELSE(
118 [AC_LANG_PROGRAM(
119 [[/* Work also in C++ mode. */
120 #define __STDC_LIMIT_MACROS 1
121
122 /* Work if build is not clean. */
123 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H
124
125 #include <limits.h>
126 #if HAVE_STDINT_H
127 #include <stdint.h>
128 #endif
129
130 #if $2
131 #define CONDITION ($3)
132 #elif HAVE_LONG_LONG_INT
133 #define CONDITION ($4)
134 #else
135 #define CONDITION 0
136 #endif
137 int test[CONDITION ? 1 : -1];]])],
138 [gl_cv_test_$1=yes],
139 [gl_cv_test_$1=no])])
140 if test $gl_cv_test_$1 = yes; then
141 $1=1;
142 else
143 $1=0;
144 fi
145 AC_SUBST([$1])
146])
147
43AC_DEFUN([gl_INTTYPES_MODULE_INDICATOR], 148AC_DEFUN([gl_INTTYPES_MODULE_INDICATOR],
44[ 149[
45 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 150 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
@@ -58,8 +163,10 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS],
58 HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV]) 163 HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV])
59 HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX]) 164 HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX])
60 HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX]) 165 HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX])
166 INT32_MAX_LT_INTMAX_MAX=1; AC_SUBST([INT32_MAX_LT_INTMAX_MAX])
61 INT64_MAX_EQ_LONG_MAX='defined _LP64'; AC_SUBST([INT64_MAX_EQ_LONG_MAX]) 167 INT64_MAX_EQ_LONG_MAX='defined _LP64'; AC_SUBST([INT64_MAX_EQ_LONG_MAX])
62 PRI_MACROS_BROKEN=0; AC_SUBST([PRI_MACROS_BROKEN]) 168 PRI_MACROS_BROKEN=0; AC_SUBST([PRI_MACROS_BROKEN])
63 PRIPTR_PREFIX=__PRIPTR_PREFIX; AC_SUBST([PRIPTR_PREFIX]) 169 PRIPTR_PREFIX=__PRIPTR_PREFIX; AC_SUBST([PRIPTR_PREFIX])
170 UINT32_MAX_LT_UINTMAX_MAX=1; AC_SUBST([UINT32_MAX_LT_UINTMAX_MAX])
64 UINT64_MAX_EQ_ULONG_MAX='defined _LP64'; AC_SUBST([UINT64_MAX_EQ_ULONG_MAX]) 171 UINT64_MAX_EQ_ULONG_MAX='defined _LP64'; AC_SUBST([UINT64_MAX_EQ_ULONG_MAX])
65]) 172])
diff --git a/m4/strtoumax.m4 b/m4/strtoumax.m4
index 3ca38cdbc93..7fa563642a8 100644
--- a/m4/strtoumax.m4
+++ b/m4/strtoumax.m4
@@ -23,5 +23,4 @@ AC_DEFUN([gl_FUNC_STRTOUMAX],
23AC_DEFUN([gl_PREREQ_STRTOUMAX], [ 23AC_DEFUN([gl_PREREQ_STRTOUMAX], [
24 AC_CHECK_DECLS([strtoull]) 24 AC_CHECK_DECLS([strtoull])
25 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) 25 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
26 gl_FUNC_STRTOULL
27]) 26])