diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-05-18 19:57:24 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-05-18 19:57:24 +0000 |
commit | 755b04521a5b37ceac529df984c9ca1e466741c6 (patch) | |
tree | f44b464dcad4c03281027aa95ca5e1dd11b2e7b9 /m4/size_max.m4 | |
parent | 55406e60956ebbd4e50e0907e0bcd94df5f71d55 (diff) | |
download | gnunet-755b04521a5b37ceac529df984c9ca1e466741c6.tar.gz gnunet-755b04521a5b37ceac529df984c9ca1e466741c6.zip |
-gettext and libtoolize updates
Diffstat (limited to 'm4/size_max.m4')
-rw-r--r-- | m4/size_max.m4 | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/m4/size_max.m4 b/m4/size_max.m4 index bfba811eb..7e192d5e9 100644 --- a/m4/size_max.m4 +++ b/m4/size_max.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # size_max.m4 serial 5 | 1 | # size_max.m4 serial 10 |
2 | dnl Copyright (C) 2003, 2005-2006 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003, 2005-2006, 2008-2014 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -8,10 +8,9 @@ dnl From Bruno Haible. | |||
8 | 8 | ||
9 | AC_DEFUN([gl_SIZE_MAX], | 9 | AC_DEFUN([gl_SIZE_MAX], |
10 | [ | 10 | [ |
11 | AC_CHECK_HEADERS(stdint.h) | 11 | AC_CHECK_HEADERS([stdint.h]) |
12 | dnl First test whether the system already has SIZE_MAX. | 12 | dnl First test whether the system already has SIZE_MAX. |
13 | AC_MSG_CHECKING([for SIZE_MAX]) | 13 | AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [ |
14 | AC_CACHE_VAL([gl_cv_size_max], [ | ||
15 | gl_cv_size_max= | 14 | gl_cv_size_max= |
16 | AC_EGREP_CPP([Found it], [ | 15 | AC_EGREP_CPP([Found it], [ |
17 | #include <limits.h> | 16 | #include <limits.h> |
@@ -21,24 +20,28 @@ AC_DEFUN([gl_SIZE_MAX], | |||
21 | #ifdef SIZE_MAX | 20 | #ifdef SIZE_MAX |
22 | Found it | 21 | Found it |
23 | #endif | 22 | #endif |
24 | ], gl_cv_size_max=yes) | 23 | ], [gl_cv_size_max=yes]) |
25 | if test -z "$gl_cv_size_max"; then | 24 | if test -z "$gl_cv_size_max"; then |
26 | dnl Define it ourselves. Here we assume that the type 'size_t' is not wider | 25 | dnl Define it ourselves. Here we assume that the type 'size_t' is not wider |
27 | dnl than the type 'unsigned long'. Try hard to find a definition that can | 26 | dnl than the type 'unsigned long'. Try hard to find a definition that can |
28 | dnl be used in a preprocessor #if, i.e. doesn't contain a cast. | 27 | dnl be used in a preprocessor #if, i.e. doesn't contain a cast. |
29 | _AC_COMPUTE_INT([sizeof (size_t) * CHAR_BIT - 1], size_t_bits_minus_1, | 28 | AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1], |
30 | [#include <stddef.h> | 29 | [#include <stddef.h> |
31 | #include <limits.h>], size_t_bits_minus_1=) | 30 | #include <limits.h>], [size_t_bits_minus_1=]) |
32 | _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, | 31 | AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)], |
33 | [#include <stddef.h>], fits_in_uint=) | 32 | [#include <stddef.h>], [fits_in_uint=]) |
34 | if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then | 33 | if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then |
35 | if test $fits_in_uint = 1; then | 34 | if test $fits_in_uint = 1; then |
36 | dnl Even though SIZE_MAX fits in an unsigned int, it must be of type | 35 | dnl Even though SIZE_MAX fits in an unsigned int, it must be of type |
37 | dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. | 36 | dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. |
38 | AC_TRY_COMPILE([#include <stddef.h> | 37 | AC_COMPILE_IFELSE( |
39 | extern size_t foo; | 38 | [AC_LANG_PROGRAM( |
40 | extern unsigned long foo; | 39 | [[#include <stddef.h> |
41 | ], [], fits_in_uint=0) | 40 | extern size_t foo; |
41 | extern unsigned long foo; | ||
42 | ]], | ||
43 | [[]])], | ||
44 | [fits_in_uint=0]) | ||
42 | fi | 45 | fi |
43 | dnl We cannot use 'expr' to simplify this expression, because 'expr' | 46 | dnl We cannot use 'expr' to simplify this expression, because 'expr' |
44 | dnl works only with 'long' integers in the host environment, while we | 47 | dnl works only with 'long' integers in the host environment, while we |
@@ -54,9 +57,23 @@ Found it | |||
54 | fi | 57 | fi |
55 | fi | 58 | fi |
56 | ]) | 59 | ]) |
57 | AC_MSG_RESULT([$gl_cv_size_max]) | ||
58 | if test "$gl_cv_size_max" != yes; then | 60 | if test "$gl_cv_size_max" != yes; then |
59 | AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max], | 61 | AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max], |
60 | [Define as the maximum value of type 'size_t', if the system doesn't define it.]) | 62 | [Define as the maximum value of type 'size_t', if the system doesn't define it.]) |
61 | fi | 63 | fi |
64 | dnl Don't redefine SIZE_MAX in config.h if config.h is re-included after | ||
65 | dnl <stdint.h>. Remember that the #undef in AH_VERBATIM gets replaced with | ||
66 | dnl #define by AC_DEFINE_UNQUOTED. | ||
67 | AH_VERBATIM([SIZE_MAX], | ||
68 | [/* Define as the maximum value of type 'size_t', if the system doesn't define | ||
69 | it. */ | ||
70 | #ifndef SIZE_MAX | ||
71 | # undef SIZE_MAX | ||
72 | #endif]) | ||
73 | ]) | ||
74 | |||
75 | dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. | ||
76 | dnl Remove this when we can assume autoconf >= 2.61. | ||
77 | m4_ifdef([AC_COMPUTE_INT], [], [ | ||
78 | AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) | ||
62 | ]) | 79 | ]) |