diff options
Diffstat (limited to 'm4')
| -rw-r--r-- | m4/gl-comp.m4 | 49 | ||||
| -rw-r--r-- | m4/inttypes-pri.m4 | 42 | ||||
| -rw-r--r-- | m4/inttypes.m4 | 302 | ||||
| -rw-r--r-- | m4/strtoimax.m4 | 30 | ||||
| -rw-r--r-- | m4/strtol.m4 | 10 | ||||
| -rw-r--r-- | m4/strtoll.m4 | 25 | ||||
| -rw-r--r-- | m4/strtoul.m4 | 10 | ||||
| -rw-r--r-- | m4/strtoull.m4 | 25 | ||||
| -rw-r--r-- | m4/strtoumax.m4 | 30 | ||||
| -rw-r--r-- | m4/wchar_h.m4 | 232 | ||||
| -rw-r--r-- | m4/wint_t.m4 | 32 |
11 files changed, 787 insertions, 0 deletions
diff --git a/m4/gl-comp.m4 b/m4/gl-comp.m4 index 3ca40ee39bd..5318a3fb61c 100644 --- a/m4/gl-comp.m4 +++ b/m4/gl-comp.m4 | |||
| @@ -43,6 +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: | ||
| 46 | # Code from module lstat: | 47 | # Code from module lstat: |
| 47 | # Code from module mktime: | 48 | # Code from module mktime: |
| 48 | # Code from module multiarch: | 49 | # Code from module multiarch: |
| @@ -56,12 +57,20 @@ AC_DEFUN([gl_EARLY], | |||
| 56 | # Code from module stdio: | 57 | # Code from module stdio: |
| 57 | # Code from module stdlib: | 58 | # Code from module stdlib: |
| 58 | # Code from module strftime: | 59 | # Code from module strftime: |
| 60 | # Code from module strtoimax: | ||
| 61 | # Code from module strtol: | ||
| 62 | # Code from module strtoll: | ||
| 63 | # Code from module strtoul: | ||
| 64 | # Code from module strtoull: | ||
| 65 | # Code from module strtoumax: | ||
| 59 | # Code from module symlink: | 66 | # Code from module symlink: |
| 60 | # Code from module sys_stat: | 67 | # Code from module sys_stat: |
| 61 | # Code from module time: | 68 | # Code from module time: |
| 62 | # Code from module time_r: | 69 | # Code from module time_r: |
| 63 | # Code from module unistd: | 70 | # Code from module unistd: |
| 71 | # Code from module verify: | ||
| 64 | # Code from module warn-on-use: | 72 | # Code from module warn-on-use: |
| 73 | # Code from module wchar: | ||
| 65 | ]) | 74 | ]) |
| 66 | 75 | ||
| 67 | # This macro should be invoked from ./configure.in, in the section | 76 | # This macro should be invoked from ./configure.in, in the section |
| @@ -108,6 +117,8 @@ AC_DEFUN([gl_INIT], | |||
| 108 | AC_REQUIRE([AC_C_INLINE]) | 117 | AC_REQUIRE([AC_C_INLINE]) |
| 109 | # Code from module include_next: | 118 | # Code from module include_next: |
| 110 | # Code from module intprops: | 119 | # Code from module intprops: |
| 120 | # Code from module inttypes: | ||
| 121 | gl_INTTYPES_H | ||
| 111 | # Code from module lstat: | 122 | # Code from module lstat: |
| 112 | gl_FUNC_LSTAT | 123 | gl_FUNC_LSTAT |
| 113 | gl_SYS_STAT_MODULE_INDICATOR([lstat]) | 124 | gl_SYS_STAT_MODULE_INDICATOR([lstat]) |
| @@ -138,6 +149,22 @@ AC_DEFUN([gl_INIT], | |||
| 138 | gl_STDLIB_H | 149 | gl_STDLIB_H |
| 139 | # Code from module strftime: | 150 | # Code from module strftime: |
| 140 | gl_FUNC_GNU_STRFTIME | 151 | gl_FUNC_GNU_STRFTIME |
| 152 | # Code from module strtoimax: | ||
| 153 | gl_FUNC_STRTOIMAX | ||
| 154 | gl_INTTYPES_MODULE_INDICATOR([strtoimax]) | ||
| 155 | # Code from module strtol: | ||
| 156 | gl_FUNC_STRTOL | ||
| 157 | # Code from module strtoll: | ||
| 158 | gl_FUNC_STRTOLL | ||
| 159 | gl_STDLIB_MODULE_INDICATOR([strtoll]) | ||
| 160 | # Code from module strtoul: | ||
| 161 | gl_FUNC_STRTOUL | ||
| 162 | # Code from module strtoull: | ||
| 163 | gl_FUNC_STRTOULL | ||
| 164 | gl_STDLIB_MODULE_INDICATOR([strtoull]) | ||
| 165 | # Code from module strtoumax: | ||
| 166 | gl_FUNC_STRTOUMAX | ||
| 167 | gl_INTTYPES_MODULE_INDICATOR([strtoumax]) | ||
| 141 | # Code from module symlink: | 168 | # Code from module symlink: |
| 142 | gl_FUNC_SYMLINK | 169 | gl_FUNC_SYMLINK |
| 143 | gl_UNISTD_MODULE_INDICATOR([symlink]) | 170 | gl_UNISTD_MODULE_INDICATOR([symlink]) |
| @@ -151,7 +178,10 @@ AC_DEFUN([gl_INIT], | |||
| 151 | gl_TIME_MODULE_INDICATOR([time_r]) | 178 | gl_TIME_MODULE_INDICATOR([time_r]) |
| 152 | # Code from module unistd: | 179 | # Code from module unistd: |
| 153 | gl_UNISTD_H | 180 | gl_UNISTD_H |
| 181 | # Code from module verify: | ||
| 154 | # Code from module warn-on-use: | 182 | # Code from module warn-on-use: |
| 183 | # Code from module wchar: | ||
| 184 | gl_WCHAR_H | ||
| 155 | # End of code from modules | 185 | # End of code from modules |
| 156 | m4_ifval(gl_LIBSOURCES_LIST, [ | 186 | m4_ifval(gl_LIBSOURCES_LIST, [ |
| 157 | m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || | 187 | m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || |
| @@ -313,6 +343,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 313 | lib/gettext.h | 343 | lib/gettext.h |
| 314 | lib/ignore-value.h | 344 | lib/ignore-value.h |
| 315 | lib/intprops.h | 345 | lib/intprops.h |
| 346 | lib/inttypes.in.h | ||
| 316 | lib/lstat.c | 347 | lib/lstat.c |
| 317 | lib/md5.c | 348 | lib/md5.c |
| 318 | lib/md5.h | 349 | lib/md5.h |
| @@ -327,11 +358,19 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 327 | lib/stdlib.in.h | 358 | lib/stdlib.in.h |
| 328 | lib/strftime.c | 359 | lib/strftime.c |
| 329 | lib/strftime.h | 360 | lib/strftime.h |
| 361 | lib/strtoimax.c | ||
| 362 | lib/strtol.c | ||
| 363 | lib/strtoll.c | ||
| 364 | lib/strtoul.c | ||
| 365 | lib/strtoull.c | ||
| 366 | lib/strtoumax.c | ||
| 330 | lib/symlink.c | 367 | lib/symlink.c |
| 331 | lib/sys_stat.in.h | 368 | lib/sys_stat.in.h |
| 332 | lib/time.in.h | 369 | lib/time.in.h |
| 333 | lib/time_r.c | 370 | lib/time_r.c |
| 334 | lib/unistd.in.h | 371 | lib/unistd.in.h |
| 372 | lib/verify.h | ||
| 373 | lib/wchar.in.h | ||
| 335 | m4/00gnulib.m4 | 374 | m4/00gnulib.m4 |
| 336 | m4/c-strtod.m4 | 375 | m4/c-strtod.m4 |
| 337 | m4/extensions.m4 | 376 | m4/extensions.m4 |
| @@ -340,6 +379,8 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 340 | m4/getopt.m4 | 379 | m4/getopt.m4 |
| 341 | m4/gnulib-common.m4 | 380 | m4/gnulib-common.m4 |
| 342 | m4/include_next.m4 | 381 | m4/include_next.m4 |
| 382 | m4/inttypes-pri.m4 | ||
| 383 | m4/inttypes.m4 | ||
| 343 | m4/longlong.m4 | 384 | m4/longlong.m4 |
| 344 | m4/lstat.m4 | 385 | m4/lstat.m4 |
| 345 | m4/md5.m4 | 386 | m4/md5.m4 |
| @@ -356,6 +397,12 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 356 | m4/stdio_h.m4 | 397 | m4/stdio_h.m4 |
| 357 | m4/stdlib_h.m4 | 398 | m4/stdlib_h.m4 |
| 358 | m4/strftime.m4 | 399 | m4/strftime.m4 |
| 400 | m4/strtoimax.m4 | ||
| 401 | m4/strtol.m4 | ||
| 402 | m4/strtoll.m4 | ||
| 403 | m4/strtoul.m4 | ||
| 404 | m4/strtoull.m4 | ||
| 405 | m4/strtoumax.m4 | ||
| 359 | m4/symlink.m4 | 406 | m4/symlink.m4 |
| 360 | m4/sys_stat_h.m4 | 407 | m4/sys_stat_h.m4 |
| 361 | m4/time_h.m4 | 408 | m4/time_h.m4 |
| @@ -363,5 +410,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 363 | m4/tm_gmtoff.m4 | 410 | m4/tm_gmtoff.m4 |
| 364 | m4/unistd_h.m4 | 411 | m4/unistd_h.m4 |
| 365 | m4/warn-on-use.m4 | 412 | m4/warn-on-use.m4 |
| 413 | m4/wchar_h.m4 | ||
| 366 | m4/wchar_t.m4 | 414 | m4/wchar_t.m4 |
| 415 | m4/wint_t.m4 | ||
| 367 | ]) | 416 | ]) |
diff --git a/m4/inttypes-pri.m4 b/m4/inttypes-pri.m4 new file mode 100644 index 00000000000..e252b27e8cb --- /dev/null +++ b/m4/inttypes-pri.m4 | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | # inttypes-pri.m4 serial 7 (gettext-0.18.2) | ||
| 2 | dnl Copyright (C) 1997-2002, 2006, 2008-2011 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | dnl From Bruno Haible. | ||
| 8 | |||
| 9 | AC_PREREQ([2.53]) | ||
| 10 | |||
| 11 | # Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI* | ||
| 12 | # macros to non-string values. This is the case on AIX 4.3.3. | ||
| 13 | |||
| 14 | AC_DEFUN([gt_INTTYPES_PRI], | ||
| 15 | [ | ||
| 16 | AC_CHECK_HEADERS([inttypes.h]) | ||
| 17 | if test $ac_cv_header_inttypes_h = yes; then | ||
| 18 | AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], | ||
| 19 | [gt_cv_inttypes_pri_broken], | ||
| 20 | [ | ||
| 21 | AC_COMPILE_IFELSE( | ||
| 22 | [AC_LANG_PROGRAM( | ||
| 23 | [[ | ||
| 24 | #include <inttypes.h> | ||
| 25 | #ifdef PRId32 | ||
| 26 | char *p = PRId32; | ||
| 27 | #endif | ||
| 28 | ]], | ||
| 29 | [[]])], | ||
| 30 | [gt_cv_inttypes_pri_broken=no], | ||
| 31 | [gt_cv_inttypes_pri_broken=yes]) | ||
| 32 | ]) | ||
| 33 | fi | ||
| 34 | if test "$gt_cv_inttypes_pri_broken" = yes; then | ||
| 35 | AC_DEFINE_UNQUOTED([PRI_MACROS_BROKEN], [1], | ||
| 36 | [Define if <inttypes.h> exists and defines unusable PRI* macros.]) | ||
| 37 | PRI_MACROS_BROKEN=1 | ||
| 38 | else | ||
| 39 | PRI_MACROS_BROKEN=0 | ||
| 40 | fi | ||
| 41 | AC_SUBST([PRI_MACROS_BROKEN]) | ||
| 42 | ]) | ||
diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 new file mode 100644 index 00000000000..92a4ac019f5 --- /dev/null +++ b/m4/inttypes.m4 | |||
| @@ -0,0 +1,302 @@ | |||
| 1 | # inttypes.m4 serial 18 | ||
| 2 | dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | dnl From Derek Price, Bruno Haible. | ||
| 8 | dnl Test whether <inttypes.h> is supported or must be substituted. | ||
| 9 | |||
| 10 | AC_DEFUN([gl_INTTYPES_H], | ||
| 11 | [ | ||
| 12 | AC_REQUIRE([gl_STDINT_H]) | ||
| 13 | AC_REQUIRE([gt_INTTYPES_PRI]) | ||
| 14 | AC_CHECK_HEADERS_ONCE([inttypes.h]) | ||
| 15 | AC_CHECK_DECLS_ONCE([imaxabs]) | ||
| 16 | AC_CHECK_DECLS_ONCE([imaxdiv]) | ||
| 17 | AC_CHECK_DECLS_ONCE([strtoimax]) | ||
| 18 | AC_CHECK_DECLS_ONCE([strtoumax]) | ||
| 19 | |||
| 20 | dnl Now see if we need a substitute <inttypes.h>. | ||
| 21 | dnl A complete <inttypes.h> requires | ||
| 22 | dnl - a complete <stdint.h>, | ||
| 23 | dnl - the existence of an <inttypes.h>, | ||
| 24 | dnl - that imaxabs, imaxdiv, strtoimax, strtoumax are declared, | ||
| 25 | dnl - some additional tests. | ||
| 26 | AC_CACHE_CHECK([whether inttypes.h conforms to C99], | ||
| 27 | [gl_cv_header_working_inttypes_h], | ||
| 28 | [gl_cv_header_working_inttypes_h=no | ||
| 29 | if test "$gl_cv_header_working_stdint_h" = yes \ | ||
| 30 | && test $ac_cv_header_inttypes_h = yes \ | ||
| 31 | && test "$ac_cv_have_decl_imaxabs" = yes \ | ||
| 32 | && test "$ac_cv_have_decl_imaxdiv" = yes \ | ||
| 33 | && test "$ac_cv_have_decl_strtoimax" = yes \ | ||
| 34 | && test "$ac_cv_have_decl_strtoumax" = yes; then | ||
| 35 | AC_COMPILE_IFELSE([ | ||
| 36 | AC_LANG_PROGRAM([[ | ||
| 37 | #include <stddef.h> | ||
| 38 | #define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ | ||
| 39 | #define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ | ||
| 40 | #define __STDC_FORMAT_MACROS 1 /* to make it work also in C++ mode */ | ||
| 41 | #define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H /* work if build isn't clean */ | ||
| 42 | #include <inttypes.h> | ||
| 43 | |||
| 44 | /* No need to duplicate the tests of stdint.m4; they are subsumed by | ||
| 45 | $gl_cv_header_working_stdint_h = yes. */ | ||
| 46 | |||
| 47 | /* Tests for macros supposed to be defined in inttypes.h. */ | ||
| 48 | |||
| 49 | const char *k = /* implicit string concatenation */ | ||
| 50 | #ifdef INT8_MAX | ||
| 51 | PRId8 PRIi8 | ||
| 52 | #endif | ||
| 53 | #ifdef UINT8_MAX | ||
| 54 | PRIo8 PRIu8 PRIx8 PRIX8 | ||
| 55 | #endif | ||
| 56 | #ifdef INT16_MAX | ||
| 57 | PRId16 PRIi16 | ||
| 58 | #endif | ||
| 59 | #ifdef UINT16_MAX | ||
| 60 | PRIo16 PRIu16 PRIx16 PRIX16 | ||
| 61 | #endif | ||
| 62 | #ifdef INT32_MAX | ||
| 63 | PRId32 PRIi32 | ||
| 64 | #endif | ||
| 65 | #ifdef UINT32_MAX | ||
| 66 | PRIo32 PRIu32 PRIx32 PRIX32 | ||
| 67 | #endif | ||
| 68 | #ifdef INT64_MAX | ||
| 69 | PRId64 PRIi64 | ||
| 70 | #endif | ||
| 71 | #ifdef UINT64_MAX | ||
| 72 | PRIo64 PRIu64 PRIx64 PRIX64 | ||
| 73 | #endif | ||
| 74 | PRIdLEAST8 PRIiLEAST8 PRIoLEAST8 PRIuLEAST8 PRIxLEAST8 PRIXLEAST8 | ||
| 75 | PRIdLEAST16 PRIiLEAST16 PRIoLEAST16 PRIuLEAST16 PRIxLEAST16 PRIXLEAST16 | ||
| 76 | PRIdLEAST32 PRIiLEAST32 PRIoLEAST32 PRIuLEAST32 PRIxLEAST32 PRIXLEAST32 | ||
| 77 | PRIdLEAST64 PRIiLEAST64 | ||
| 78 | PRIoLEAST64 PRIuLEAST64 PRIxLEAST64 PRIXLEAST64 | ||
| 79 | PRIdFAST8 PRIiFAST8 PRIoFAST8 PRIuFAST8 PRIxFAST8 PRIXFAST8 | ||
| 80 | PRIdFAST16 PRIiFAST16 PRIoFAST16 PRIuFAST16 PRIxFAST16 PRIXFAST16 | ||
| 81 | PRIdFAST32 PRIiFAST32 PRIoFAST32 PRIuFAST32 PRIxFAST32 PRIXFAST32 | ||
| 82 | PRIdFAST64 PRIiFAST64 | ||
| 83 | PRIoFAST64 PRIuFAST64 PRIxFAST64 PRIXFAST64 | ||
| 84 | PRIdMAX PRIiMAX PRIoMAX PRIuMAX PRIxMAX PRIXMAX | ||
| 85 | #ifdef INTPTR_MAX | ||
| 86 | PRIdPTR PRIiPTR | ||
| 87 | #endif | ||
| 88 | #ifdef UINTPTR_MAX | ||
| 89 | PRIoPTR PRIuPTR PRIxPTR PRIXPTR | ||
| 90 | #endif | ||
| 91 | ; | ||
| 92 | const char *l = /* implicit string concatenation */ | ||
| 93 | #ifdef INT8_MAX | ||
| 94 | SCNd8 SCNi8 | ||
| 95 | #endif | ||
| 96 | #ifdef UINT8_MAX | ||
| 97 | SCNo8 SCNu8 SCNx8 | ||
| 98 | #endif | ||
| 99 | #ifdef INT16_MAX | ||
| 100 | SCNd16 SCNi16 | ||
| 101 | #endif | ||
| 102 | #ifdef UINT16_MAX | ||
| 103 | SCNo16 SCNu16 SCNx16 | ||
| 104 | #endif | ||
| 105 | #ifdef INT32_MAX | ||
| 106 | SCNd32 SCNi32 | ||
| 107 | #endif | ||
| 108 | #ifdef UINT32_MAX | ||
| 109 | SCNo32 SCNu32 SCNx32 | ||
| 110 | #endif | ||
| 111 | #ifdef INT64_MAX | ||
| 112 | SCNd64 SCNi64 | ||
| 113 | #endif | ||
| 114 | #ifdef UINT64_MAX | ||
| 115 | SCNo64 SCNu64 SCNx64 | ||
| 116 | #endif | ||
| 117 | SCNdLEAST8 SCNiLEAST8 SCNoLEAST8 SCNuLEAST8 SCNxLEAST8 | ||
| 118 | SCNdLEAST16 SCNiLEAST16 SCNoLEAST16 SCNuLEAST16 SCNxLEAST16 | ||
| 119 | SCNdLEAST32 SCNiLEAST32 SCNoLEAST32 SCNuLEAST32 SCNxLEAST32 | ||
| 120 | SCNdLEAST64 SCNiLEAST64 | ||
| 121 | SCNoLEAST64 SCNuLEAST64 SCNxLEAST64 | ||
| 122 | SCNdFAST8 SCNiFAST8 SCNoFAST8 SCNuFAST8 SCNxFAST8 | ||
| 123 | SCNdFAST16 SCNiFAST16 SCNoFAST16 SCNuFAST16 SCNxFAST16 | ||
| 124 | SCNdFAST32 SCNiFAST32 SCNoFAST32 SCNuFAST32 SCNxFAST32 | ||
| 125 | SCNdFAST64 SCNiFAST64 | ||
| 126 | SCNoFAST64 SCNuFAST64 SCNxFAST64 | ||
| 127 | SCNdMAX SCNiMAX SCNoMAX SCNuMAX SCNxMAX | ||
| 128 | #ifdef INTPTR_MAX | ||
| 129 | SCNdPTR SCNiPTR | ||
| 130 | #endif | ||
| 131 | #ifdef UINTPTR_MAX | ||
| 132 | SCNoPTR SCNuPTR SCNxPTR | ||
| 133 | #endif | ||
| 134 | ; | ||
| 135 | ]])], | ||
| 136 | [gl_cv_header_working_inttypes_h=yes]) | ||
| 137 | fi]) | ||
| 138 | |||
| 139 | dnl Override <inttypes.h> always, so that the portability warnings work. | ||
| 140 | AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) | ||
| 141 | gl_CHECK_NEXT_HEADERS([inttypes.h]) | ||
| 142 | |||
| 143 | AC_REQUIRE([gl_MULTIARCH]) | ||
| 144 | |||
| 145 | dnl Ensure that <stdint.h> defines the limit macros, since gnulib's | ||
| 146 | dnl <inttypes.h> relies on them. This macro is only needed when a | ||
| 147 | dnl C++ compiler is in use; it has no effect for a C compiler. | ||
| 148 | dnl Also be careful to define __STDC_LIMIT_MACROS only when gnulib's | ||
| 149 | dnl <inttypes.h> is going to be created, and to avoid redefinition warnings | ||
| 150 | dnl if the __STDC_LIMIT_MACROS is already defined through the CPPFLAGS. | ||
| 151 | AC_DEFINE([GL_TRIGGER_STDC_LIMIT_MACROS], [1], | ||
| 152 | [Define to make the limit macros in <stdint.h> visible.]) | ||
| 153 | AH_VERBATIM([__STDC_LIMIT_MACROS_ZZZ], | ||
| 154 | [/* Ensure that <stdint.h> defines the limit macros, since gnulib's | ||
| 155 | <inttypes.h> relies on them. */ | ||
| 156 | #if defined __cplusplus && !defined __STDC_LIMIT_MACROS && GL_TRIGGER_STDC_LIMIT_MACROS | ||
| 157 | # define __STDC_LIMIT_MACROS 1 | ||
| 158 | #endif | ||
| 159 | ]) | ||
| 160 | |||
| 161 | PRIPTR_PREFIX= | ||
| 162 | if test -n "$STDINT_H"; then | ||
| 163 | dnl Using the gnulib <stdint.h>. It always defines intptr_t to 'long'. | ||
| 164 | PRIPTR_PREFIX='"l"' | ||
| 165 | else | ||
| 166 | dnl Using the system's <stdint.h>. | ||
| 167 | for glpfx in '' l ll I64; do | ||
| 168 | case $glpfx in | ||
| 169 | '') gltype1='int';; | ||
| 170 | l) gltype1='long int';; | ||
| 171 | ll) gltype1='long long int';; | ||
| 172 | I64) gltype1='__int64';; | ||
| 173 | esac | ||
| 174 | AC_COMPILE_IFELSE( | ||
| 175 | [AC_LANG_PROGRAM([[#include <stdint.h> | ||
| 176 | extern intptr_t foo; | ||
| 177 | extern $gltype1 foo;]])], | ||
| 178 | [PRIPTR_PREFIX='"'$glpfx'"']) | ||
| 179 | test -n "$PRIPTR_PREFIX" && break | ||
| 180 | done | ||
| 181 | fi | ||
| 182 | AC_SUBST([PRIPTR_PREFIX]) | ||
| 183 | |||
| 184 | if test "$ac_cv_have_decl_imaxabs" = yes; then | ||
| 185 | HAVE_DECL_IMAXABS=1 | ||
| 186 | else | ||
| 187 | HAVE_DECL_IMAXABS=0 | ||
| 188 | fi | ||
| 189 | |||
| 190 | if test "$ac_cv_have_decl_imaxdiv" = yes; then | ||
| 191 | HAVE_DECL_IMAXDIV=1 | ||
| 192 | else | ||
| 193 | HAVE_DECL_IMAXDIV=0 | ||
| 194 | fi | ||
| 195 | |||
| 196 | if test "$ac_cv_have_decl_strtoimax" = yes; then | ||
| 197 | HAVE_DECL_STRTOIMAX=1 | ||
| 198 | else | ||
| 199 | HAVE_DECL_STRTOIMAX=0 | ||
| 200 | fi | ||
| 201 | |||
| 202 | if test "$ac_cv_have_decl_strtoumax" = yes; then | ||
| 203 | HAVE_DECL_STRTOUMAX=1 | ||
| 204 | else | ||
| 205 | HAVE_DECL_STRTOUMAX=0 | ||
| 206 | fi | ||
| 207 | |||
| 208 | gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( | ||
| 209 | [INT32_MAX_LT_INTMAX_MAX], | ||
| 210 | [defined INT32_MAX && defined INTMAX_MAX], | ||
| 211 | [INT32_MAX < INTMAX_MAX], | ||
| 212 | [sizeof (int) < sizeof (long long int)]) | ||
| 213 | if test $APPLE_UNIVERSAL_BUILD = 0; then | ||
| 214 | gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( | ||
| 215 | [INT64_MAX_EQ_LONG_MAX], | ||
| 216 | [defined INT64_MAX], | ||
| 217 | [INT64_MAX == LONG_MAX], | ||
| 218 | [sizeof (long long int) == sizeof (long int)]) | ||
| 219 | else | ||
| 220 | INT64_MAX_EQ_LONG_MAX=-1 | ||
| 221 | fi | ||
| 222 | gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( | ||
| 223 | [UINT32_MAX_LT_UINTMAX_MAX], | ||
| 224 | [defined UINT32_MAX && defined UINTMAX_MAX], | ||
| 225 | [UINT32_MAX < UINTMAX_MAX], | ||
| 226 | [sizeof (unsigned int) < sizeof (unsigned long long int)]) | ||
| 227 | if test $APPLE_UNIVERSAL_BUILD = 0; then | ||
| 228 | gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( | ||
| 229 | [UINT64_MAX_EQ_ULONG_MAX], | ||
| 230 | [defined UINT64_MAX], | ||
| 231 | [UINT64_MAX == ULONG_MAX], | ||
| 232 | [sizeof (unsigned long long int) == sizeof (unsigned long int)]) | ||
| 233 | else | ||
| 234 | UINT64_MAX_EQ_ULONG_MAX=-1 | ||
| 235 | fi | ||
| 236 | |||
| 237 | dnl Check for declarations of anything we want to poison if the | ||
| 238 | dnl corresponding gnulib module is not in use. | ||
| 239 | gl_WARN_ON_USE_PREPARE([[#include <inttypes.h> | ||
| 240 | ]], [imaxabs imaxdiv strtoimax strtoumax]) | ||
| 241 | ]) | ||
| 242 | |||
| 243 | # Define the symbol $1 to be 1 if the condition is true, 0 otherwise. | ||
| 244 | # If $2 is true, the condition is $3; otherwise if long long int is supported | ||
| 245 | # approximate the condition with $4; otherwise, assume the condition is false. | ||
| 246 | # The condition should work on all C99 platforms; the approximations should be | ||
| 247 | # good enough to work on all practical pre-C99 platforms. | ||
| 248 | # $2 is evaluated by the C preprocessor, $3 and $4 as compile-time constants. | ||
| 249 | AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION], | ||
| 250 | [ | ||
| 251 | AC_CACHE_CHECK([whether $3], | ||
| 252 | [gl_cv_test_$1], | ||
| 253 | [AC_COMPILE_IFELSE( | ||
| 254 | [AC_LANG_PROGRAM( | ||
| 255 | [[/* Work also in C++ mode. */ | ||
| 256 | #define __STDC_LIMIT_MACROS 1 | ||
| 257 | |||
| 258 | /* Work if build is not clean. */ | ||
| 259 | #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H | ||
| 260 | |||
| 261 | #include <limits.h> | ||
| 262 | #if HAVE_STDINT_H | ||
| 263 | #include <stdint.h> | ||
| 264 | #endif | ||
| 265 | |||
| 266 | #if $2 | ||
| 267 | #define CONDITION ($3) | ||
| 268 | #elif HAVE_LONG_LONG_INT | ||
| 269 | #define CONDITION ($4) | ||
| 270 | #else | ||
| 271 | #define CONDITION 0 | ||
| 272 | #endif | ||
| 273 | int test[CONDITION ? 1 : -1];]])], | ||
| 274 | [gl_cv_test_$1=yes], | ||
| 275 | [gl_cv_test_$1=no])]) | ||
| 276 | if test $gl_cv_test_$1 = yes; then | ||
| 277 | $1=1; | ||
| 278 | else | ||
| 279 | $1=0; | ||
| 280 | fi | ||
| 281 | AC_SUBST([$1]) | ||
| 282 | ]) | ||
| 283 | |||
| 284 | AC_DEFUN([gl_INTTYPES_MODULE_INDICATOR], | ||
| 285 | [ | ||
| 286 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | ||
| 287 | AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) | ||
| 288 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | ||
| 289 | ]) | ||
| 290 | |||
| 291 | AC_DEFUN([gl_INTTYPES_H_DEFAULTS], | ||
| 292 | [ | ||
| 293 | GNULIB_IMAXABS=0; AC_SUBST([GNULIB_IMAXABS]) | ||
| 294 | GNULIB_IMAXDIV=0; AC_SUBST([GNULIB_IMAXDIV]) | ||
| 295 | GNULIB_STRTOIMAX=0; AC_SUBST([GNULIB_STRTOIMAX]) | ||
| 296 | GNULIB_STRTOUMAX=0; AC_SUBST([GNULIB_STRTOUMAX]) | ||
| 297 | dnl Assume proper GNU behavior unless another module says otherwise. | ||
| 298 | HAVE_DECL_IMAXABS=1; AC_SUBST([HAVE_DECL_IMAXABS]) | ||
| 299 | HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV]) | ||
| 300 | HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX]) | ||
| 301 | HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX]) | ||
| 302 | ]) | ||
diff --git a/m4/strtoimax.m4 b/m4/strtoimax.m4 new file mode 100644 index 00000000000..e82e7cd08f8 --- /dev/null +++ b/m4/strtoimax.m4 | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | # strtoimax.m4 serial 8 | ||
| 2 | dnl Copyright (C) 2002-2004, 2006, 2009-2011 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | AC_DEFUN([gl_FUNC_STRTOIMAX], | ||
| 8 | [ | ||
| 9 | AC_CACHE_CHECK([whether <inttypes.h> defines strtoimax as a macro], | ||
| 10 | gl_cv_func_strtoimax_macro, | ||
| 11 | [AC_EGREP_CPP([inttypes_h_defines_strtoimax], [#include <inttypes.h> | ||
| 12 | #ifdef strtoimax | ||
| 13 | inttypes_h_defines_strtoimax | ||
| 14 | #endif], | ||
| 15 | gl_cv_func_strtoimax_macro=yes, | ||
| 16 | gl_cv_func_strtoimax_macro=no)]) | ||
| 17 | |||
| 18 | if test "$gl_cv_func_strtoimax_macro" != yes; then | ||
| 19 | AC_REPLACE_FUNCS([strtoimax]) | ||
| 20 | if test $ac_cv_func_strtoimax = no; then | ||
| 21 | gl_PREREQ_STRTOIMAX | ||
| 22 | fi | ||
| 23 | fi | ||
| 24 | ]) | ||
| 25 | |||
| 26 | # Prerequisites of lib/strtoimax.c. | ||
| 27 | AC_DEFUN([gl_PREREQ_STRTOIMAX], [ | ||
| 28 | AC_CHECK_DECLS([strtoll]) | ||
| 29 | AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) | ||
| 30 | ]) | ||
diff --git a/m4/strtol.m4 b/m4/strtol.m4 new file mode 100644 index 00000000000..10f0284bec5 --- /dev/null +++ b/m4/strtol.m4 | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | # strtol.m4 serial 5 | ||
| 2 | dnl Copyright (C) 2002-2003, 2006, 2009-2011 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | AC_DEFUN([gl_FUNC_STRTOL], | ||
| 8 | [ | ||
| 9 | AC_REPLACE_FUNCS([strtol]) | ||
| 10 | ]) | ||
diff --git a/m4/strtoll.m4 b/m4/strtoll.m4 new file mode 100644 index 00000000000..fd0a13db1bb --- /dev/null +++ b/m4/strtoll.m4 | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | # strtoll.m4 serial 6 | ||
| 2 | dnl Copyright (C) 2002, 2004, 2006, 2008-2011 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | AC_DEFUN([gl_FUNC_STRTOLL], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | ||
| 10 | dnl We don't need (and can't compile) the replacement strtoll | ||
| 11 | dnl unless the type 'long long int' exists. | ||
| 12 | AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) | ||
| 13 | if test "$ac_cv_type_long_long_int" = yes; then | ||
| 14 | AC_REPLACE_FUNCS([strtoll]) | ||
| 15 | if test $ac_cv_func_strtoll = no; then | ||
| 16 | HAVE_STRTOLL=0 | ||
| 17 | gl_PREREQ_STRTOLL | ||
| 18 | fi | ||
| 19 | fi | ||
| 20 | ]) | ||
| 21 | |||
| 22 | # Prerequisites of lib/strtoll.c. | ||
| 23 | AC_DEFUN([gl_PREREQ_STRTOLL], [ | ||
| 24 | : | ||
| 25 | ]) | ||
diff --git a/m4/strtoul.m4 b/m4/strtoul.m4 new file mode 100644 index 00000000000..06979d16cd5 --- /dev/null +++ b/m4/strtoul.m4 | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | # strtoul.m4 serial 4 | ||
| 2 | dnl Copyright (C) 2002, 2006, 2009-2011 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | AC_DEFUN([gl_FUNC_STRTOUL], | ||
| 8 | [ | ||
| 9 | AC_REPLACE_FUNCS([strtoul]) | ||
| 10 | ]) | ||
diff --git a/m4/strtoull.m4 b/m4/strtoull.m4 new file mode 100644 index 00000000000..abf607fd7b1 --- /dev/null +++ b/m4/strtoull.m4 | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | # strtoull.m4 serial 6 | ||
| 2 | dnl Copyright (C) 2002, 2004, 2006, 2008-2011 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | AC_DEFUN([gl_FUNC_STRTOULL], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | ||
| 10 | dnl We don't need (and can't compile) the replacement strtoull | ||
| 11 | dnl unless the type 'unsigned long long int' exists. | ||
| 12 | AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) | ||
| 13 | if test "$ac_cv_type_unsigned_long_long_int" = yes; then | ||
| 14 | AC_REPLACE_FUNCS([strtoull]) | ||
| 15 | if test $ac_cv_func_strtoull = no; then | ||
| 16 | HAVE_STRTOULL=0 | ||
| 17 | gl_PREREQ_STRTOULL | ||
| 18 | fi | ||
| 19 | fi | ||
| 20 | ]) | ||
| 21 | |||
| 22 | # Prerequisites of lib/strtoull.c. | ||
| 23 | AC_DEFUN([gl_PREREQ_STRTOULL], [ | ||
| 24 | : | ||
| 25 | ]) | ||
diff --git a/m4/strtoumax.m4 b/m4/strtoumax.m4 new file mode 100644 index 00000000000..448c4d9b777 --- /dev/null +++ b/m4/strtoumax.m4 | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | # strtoumax.m4 serial 8 | ||
| 2 | dnl Copyright (C) 2002-2004, 2006, 2009-2011 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | AC_DEFUN([gl_FUNC_STRTOUMAX], | ||
| 8 | [ | ||
| 9 | AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro], | ||
| 10 | gl_cv_func_strtoumax_macro, | ||
| 11 | [AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h> | ||
| 12 | #ifdef strtoumax | ||
| 13 | inttypes_h_defines_strtoumax | ||
| 14 | #endif], | ||
| 15 | gl_cv_func_strtoumax_macro=yes, | ||
| 16 | gl_cv_func_strtoumax_macro=no)]) | ||
| 17 | |||
| 18 | if test "$gl_cv_func_strtoumax_macro" != yes; then | ||
| 19 | AC_REPLACE_FUNCS([strtoumax]) | ||
| 20 | if test $ac_cv_func_strtoumax = no; then | ||
| 21 | gl_PREREQ_STRTOUMAX | ||
| 22 | fi | ||
| 23 | fi | ||
| 24 | ]) | ||
| 25 | |||
| 26 | # Prerequisites of lib/strtoumax.c. | ||
| 27 | AC_DEFUN([gl_PREREQ_STRTOUMAX], [ | ||
| 28 | AC_CHECK_DECLS([strtoull]) | ||
| 29 | AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) | ||
| 30 | ]) | ||
diff --git a/m4/wchar_h.m4 b/m4/wchar_h.m4 new file mode 100644 index 00000000000..6255ff352de --- /dev/null +++ b/m4/wchar_h.m4 | |||
| @@ -0,0 +1,232 @@ | |||
| 1 | dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. | ||
| 2 | |||
| 3 | dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. | ||
| 4 | dnl This file is free software; the Free Software Foundation | ||
| 5 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 6 | dnl with or without modifications, as long as this notice is preserved. | ||
| 7 | |||
| 8 | dnl Written by Eric Blake. | ||
| 9 | |||
| 10 | # wchar_h.m4 serial 38 | ||
| 11 | |||
| 12 | AC_DEFUN([gl_WCHAR_H], | ||
| 13 | [ | ||
| 14 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) | ||
| 15 | AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) | ||
| 16 | dnl Prepare for creating substitute <wchar.h>. | ||
| 17 | dnl Check for <wchar.h> (missing in Linux uClibc when built without wide | ||
| 18 | dnl character support). | ||
| 19 | dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK. | ||
| 20 | gl_CHECK_NEXT_HEADERS([wchar.h]) | ||
| 21 | if test $ac_cv_header_wchar_h = yes; then | ||
| 22 | HAVE_WCHAR_H=1 | ||
| 23 | else | ||
| 24 | HAVE_WCHAR_H=0 | ||
| 25 | fi | ||
| 26 | AC_SUBST([HAVE_WCHAR_H]) | ||
| 27 | |||
| 28 | AC_REQUIRE([gl_FEATURES_H]) | ||
| 29 | |||
| 30 | AC_REQUIRE([gt_TYPE_WINT_T]) | ||
| 31 | if test $gt_cv_c_wint_t = yes; then | ||
| 32 | HAVE_WINT_T=1 | ||
| 33 | else | ||
| 34 | HAVE_WINT_T=0 | ||
| 35 | fi | ||
| 36 | AC_SUBST([HAVE_WINT_T]) | ||
| 37 | |||
| 38 | dnl Check for declarations of anything we want to poison if the | ||
| 39 | dnl corresponding gnulib module is not in use. | ||
| 40 | gl_WARN_ON_USE_PREPARE([[ | ||
| 41 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
| 42 | <wchar.h>. | ||
| 43 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
| 44 | included before <wchar.h>. */ | ||
| 45 | #if !(defined __GLIBC__ && !defined __UCLIBC__) | ||
| 46 | # include <stddef.h> | ||
| 47 | # include <stdio.h> | ||
| 48 | # include <time.h> | ||
| 49 | #endif | ||
| 50 | #include <wchar.h> | ||
| 51 | ]], | ||
| 52 | [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb | ||
| 53 | wcsrtombs wcsnrtombs wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset | ||
| 54 | wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp | ||
| 55 | wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr | ||
| 56 | wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth | ||
| 57 | ]) | ||
| 58 | ]) | ||
| 59 | |||
| 60 | dnl Check whether <wchar.h> is usable at all. | ||
| 61 | AC_DEFUN([gl_WCHAR_H_INLINE_OK], | ||
| 62 | [ | ||
| 63 | dnl Test whether <wchar.h> suffers due to the transition from '__inline' to | ||
| 64 | dnl 'gnu_inline'. See <http://sourceware.org/bugzilla/show_bug.cgi?id=4022> | ||
| 65 | dnl and <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary, | ||
| 66 | dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and | ||
| 67 | dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>. | ||
| 68 | AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly], | ||
| 69 | [gl_cv_header_wchar_h_correct_inline], | ||
| 70 | [gl_cv_header_wchar_h_correct_inline=yes | ||
| 71 | AC_LANG_CONFTEST([ | ||
| 72 | AC_LANG_SOURCE([[#define wcstod renamed_wcstod | ||
| 73 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
| 74 | <wchar.h>. | ||
| 75 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
| 76 | included before <wchar.h>. */ | ||
| 77 | #include <stddef.h> | ||
| 78 | #include <stdio.h> | ||
| 79 | #include <time.h> | ||
| 80 | #include <wchar.h> | ||
| 81 | extern int zero (void); | ||
| 82 | int main () { return zero(); } | ||
| 83 | ]])]) | ||
| 84 | if AC_TRY_EVAL([ac_compile]); then | ||
| 85 | mv conftest.$ac_objext conftest1.$ac_objext | ||
| 86 | AC_LANG_CONFTEST([ | ||
| 87 | AC_LANG_SOURCE([[#define wcstod renamed_wcstod | ||
| 88 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
| 89 | <wchar.h>. | ||
| 90 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
| 91 | included before <wchar.h>. */ | ||
| 92 | #include <stddef.h> | ||
| 93 | #include <stdio.h> | ||
| 94 | #include <time.h> | ||
| 95 | #include <wchar.h> | ||
| 96 | int zero (void) { return 0; } | ||
| 97 | ]])]) | ||
| 98 | if AC_TRY_EVAL([ac_compile]); then | ||
| 99 | mv conftest.$ac_objext conftest2.$ac_objext | ||
| 100 | if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then | ||
| 101 | : | ||
| 102 | else | ||
| 103 | gl_cv_header_wchar_h_correct_inline=no | ||
| 104 | fi | ||
| 105 | fi | ||
| 106 | fi | ||
| 107 | rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext | ||
| 108 | ]) | ||
| 109 | if test $gl_cv_header_wchar_h_correct_inline = no; then | ||
| 110 | AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS). | ||
| 111 | This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in | ||
| 112 | C99 mode. You have four options: | ||
| 113 | - Add the flag -fgnu89-inline to CC and reconfigure, or | ||
| 114 | - Fix your include files, using parts of | ||
| 115 | <http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or | ||
| 116 | - Use a gcc version older than 4.3, or | ||
| 117 | - Don't use the flags -std=c99 or -std=gnu99. | ||
| 118 | Configuration aborted.]) | ||
| 119 | fi | ||
| 120 | ]) | ||
| 121 | |||
| 122 | dnl Unconditionally enables the replacement of <wchar.h>. | ||
| 123 | AC_DEFUN([gl_REPLACE_WCHAR_H], | ||
| 124 | [ | ||
| 125 | dnl This is a no-op, because <wchar.h> is always overridden. | ||
| 126 | : | ||
| 127 | ]) | ||
| 128 | |||
| 129 | AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], | ||
| 130 | [ | ||
| 131 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | ||
| 132 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) | ||
| 133 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | ||
| 134 | dnl Define it also as a C macro, for the benefit of the unit tests. | ||
| 135 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | ||
| 136 | ]) | ||
| 137 | |||
| 138 | AC_DEFUN([gl_WCHAR_H_DEFAULTS], | ||
| 139 | [ | ||
| 140 | GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC]) | ||
| 141 | GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB]) | ||
| 142 | GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT]) | ||
| 143 | GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC]) | ||
| 144 | GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN]) | ||
| 145 | GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS]) | ||
| 146 | GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS]) | ||
| 147 | GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB]) | ||
| 148 | GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS]) | ||
| 149 | GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS]) | ||
| 150 | GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) | ||
| 151 | GNULIB_WMEMCHR=0; AC_SUBST([GNULIB_WMEMCHR]) | ||
| 152 | GNULIB_WMEMCMP=0; AC_SUBST([GNULIB_WMEMCMP]) | ||
| 153 | GNULIB_WMEMCPY=0; AC_SUBST([GNULIB_WMEMCPY]) | ||
| 154 | GNULIB_WMEMMOVE=0; AC_SUBST([GNULIB_WMEMMOVE]) | ||
| 155 | GNULIB_WMEMSET=0; AC_SUBST([GNULIB_WMEMSET]) | ||
| 156 | GNULIB_WCSLEN=0; AC_SUBST([GNULIB_WCSLEN]) | ||
| 157 | GNULIB_WCSNLEN=0; AC_SUBST([GNULIB_WCSNLEN]) | ||
| 158 | GNULIB_WCSCPY=0; AC_SUBST([GNULIB_WCSCPY]) | ||
| 159 | GNULIB_WCPCPY=0; AC_SUBST([GNULIB_WCPCPY]) | ||
| 160 | GNULIB_WCSNCPY=0; AC_SUBST([GNULIB_WCSNCPY]) | ||
| 161 | GNULIB_WCPNCPY=0; AC_SUBST([GNULIB_WCPNCPY]) | ||
| 162 | GNULIB_WCSCAT=0; AC_SUBST([GNULIB_WCSCAT]) | ||
| 163 | GNULIB_WCSNCAT=0; AC_SUBST([GNULIB_WCSNCAT]) | ||
| 164 | GNULIB_WCSCMP=0; AC_SUBST([GNULIB_WCSCMP]) | ||
| 165 | GNULIB_WCSNCMP=0; AC_SUBST([GNULIB_WCSNCMP]) | ||
| 166 | GNULIB_WCSCASECMP=0; AC_SUBST([GNULIB_WCSCASECMP]) | ||
| 167 | GNULIB_WCSNCASECMP=0; AC_SUBST([GNULIB_WCSNCASECMP]) | ||
| 168 | GNULIB_WCSCOLL=0; AC_SUBST([GNULIB_WCSCOLL]) | ||
| 169 | GNULIB_WCSXFRM=0; AC_SUBST([GNULIB_WCSXFRM]) | ||
| 170 | GNULIB_WCSDUP=0; AC_SUBST([GNULIB_WCSDUP]) | ||
| 171 | GNULIB_WCSCHR=0; AC_SUBST([GNULIB_WCSCHR]) | ||
| 172 | GNULIB_WCSRCHR=0; AC_SUBST([GNULIB_WCSRCHR]) | ||
| 173 | GNULIB_WCSCSPN=0; AC_SUBST([GNULIB_WCSCSPN]) | ||
| 174 | GNULIB_WCSSPN=0; AC_SUBST([GNULIB_WCSSPN]) | ||
| 175 | GNULIB_WCSPBRK=0; AC_SUBST([GNULIB_WCSPBRK]) | ||
| 176 | GNULIB_WCSSTR=0; AC_SUBST([GNULIB_WCSSTR]) | ||
| 177 | GNULIB_WCSTOK=0; AC_SUBST([GNULIB_WCSTOK]) | ||
| 178 | GNULIB_WCSWIDTH=0; AC_SUBST([GNULIB_WCSWIDTH]) | ||
| 179 | dnl Assume proper GNU behavior unless another module says otherwise. | ||
| 180 | HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) | ||
| 181 | HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) | ||
| 182 | HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC]) | ||
| 183 | HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN]) | ||
| 184 | HAVE_MBSRTOWCS=1; AC_SUBST([HAVE_MBSRTOWCS]) | ||
| 185 | HAVE_MBSNRTOWCS=1; AC_SUBST([HAVE_MBSNRTOWCS]) | ||
| 186 | HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB]) | ||
| 187 | HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS]) | ||
| 188 | HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS]) | ||
| 189 | HAVE_WMEMCHR=1; AC_SUBST([HAVE_WMEMCHR]) | ||
| 190 | HAVE_WMEMCMP=1; AC_SUBST([HAVE_WMEMCMP]) | ||
| 191 | HAVE_WMEMCPY=1; AC_SUBST([HAVE_WMEMCPY]) | ||
| 192 | HAVE_WMEMMOVE=1; AC_SUBST([HAVE_WMEMMOVE]) | ||
| 193 | HAVE_WMEMSET=1; AC_SUBST([HAVE_WMEMSET]) | ||
| 194 | HAVE_WCSLEN=1; AC_SUBST([HAVE_WCSLEN]) | ||
| 195 | HAVE_WCSNLEN=1; AC_SUBST([HAVE_WCSNLEN]) | ||
| 196 | HAVE_WCSCPY=1; AC_SUBST([HAVE_WCSCPY]) | ||
| 197 | HAVE_WCPCPY=1; AC_SUBST([HAVE_WCPCPY]) | ||
| 198 | HAVE_WCSNCPY=1; AC_SUBST([HAVE_WCSNCPY]) | ||
| 199 | HAVE_WCPNCPY=1; AC_SUBST([HAVE_WCPNCPY]) | ||
| 200 | HAVE_WCSCAT=1; AC_SUBST([HAVE_WCSCAT]) | ||
| 201 | HAVE_WCSNCAT=1; AC_SUBST([HAVE_WCSNCAT]) | ||
| 202 | HAVE_WCSCMP=1; AC_SUBST([HAVE_WCSCMP]) | ||
| 203 | HAVE_WCSNCMP=1; AC_SUBST([HAVE_WCSNCMP]) | ||
| 204 | HAVE_WCSCASECMP=1; AC_SUBST([HAVE_WCSCASECMP]) | ||
| 205 | HAVE_WCSNCASECMP=1; AC_SUBST([HAVE_WCSNCASECMP]) | ||
| 206 | HAVE_WCSCOLL=1; AC_SUBST([HAVE_WCSCOLL]) | ||
| 207 | HAVE_WCSXFRM=1; AC_SUBST([HAVE_WCSXFRM]) | ||
| 208 | HAVE_WCSDUP=1; AC_SUBST([HAVE_WCSDUP]) | ||
| 209 | HAVE_WCSCHR=1; AC_SUBST([HAVE_WCSCHR]) | ||
| 210 | HAVE_WCSRCHR=1; AC_SUBST([HAVE_WCSRCHR]) | ||
| 211 | HAVE_WCSCSPN=1; AC_SUBST([HAVE_WCSCSPN]) | ||
| 212 | HAVE_WCSSPN=1; AC_SUBST([HAVE_WCSSPN]) | ||
| 213 | HAVE_WCSPBRK=1; AC_SUBST([HAVE_WCSPBRK]) | ||
| 214 | HAVE_WCSSTR=1; AC_SUBST([HAVE_WCSSTR]) | ||
| 215 | HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK]) | ||
| 216 | HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH]) | ||
| 217 | HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) | ||
| 218 | HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) | ||
| 219 | REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) | ||
| 220 | REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC]) | ||
| 221 | REPLACE_WCTOB=0; AC_SUBST([REPLACE_WCTOB]) | ||
| 222 | REPLACE_MBSINIT=0; AC_SUBST([REPLACE_MBSINIT]) | ||
| 223 | REPLACE_MBRTOWC=0; AC_SUBST([REPLACE_MBRTOWC]) | ||
| 224 | REPLACE_MBRLEN=0; AC_SUBST([REPLACE_MBRLEN]) | ||
| 225 | REPLACE_MBSRTOWCS=0; AC_SUBST([REPLACE_MBSRTOWCS]) | ||
| 226 | REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS]) | ||
| 227 | REPLACE_WCRTOMB=0; AC_SUBST([REPLACE_WCRTOMB]) | ||
| 228 | REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS]) | ||
| 229 | REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS]) | ||
| 230 | REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) | ||
| 231 | REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) | ||
| 232 | ]) | ||
diff --git a/m4/wint_t.m4 b/m4/wint_t.m4 new file mode 100644 index 00000000000..da1ce3df601 --- /dev/null +++ b/m4/wint_t.m4 | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | # wint_t.m4 serial 5 (gettext-0.18.2) | ||
| 2 | dnl Copyright (C) 2003, 2007-2011 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | dnl From Bruno Haible. | ||
| 8 | dnl Test whether <wchar.h> has the 'wint_t' type. | ||
| 9 | dnl Prerequisite: AC_PROG_CC | ||
| 10 | |||
| 11 | AC_DEFUN([gt_TYPE_WINT_T], | ||
| 12 | [ | ||
| 13 | AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], | ||
| 14 | [AC_COMPILE_IFELSE( | ||
| 15 | [AC_LANG_PROGRAM( | ||
| 16 | [[ | ||
| 17 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
| 18 | <wchar.h>. | ||
| 19 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included | ||
| 20 | before <wchar.h>. */ | ||
| 21 | #include <stddef.h> | ||
| 22 | #include <stdio.h> | ||
| 23 | #include <time.h> | ||
| 24 | #include <wchar.h> | ||
| 25 | wint_t foo = (wchar_t)'\0';]], | ||
| 26 | [[]])], | ||
| 27 | [gt_cv_c_wint_t=yes], | ||
| 28 | [gt_cv_c_wint_t=no])]) | ||
| 29 | if test $gt_cv_c_wint_t = yes; then | ||
| 30 | AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.]) | ||
| 31 | fi | ||
| 32 | ]) | ||