diff options
Diffstat (limited to 'gl/m4/ssize_t.m4')
-rw-r--r-- | gl/m4/ssize_t.m4 | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/gl/m4/ssize_t.m4 b/gl/m4/ssize_t.m4 index 1c12c33..c15f948 100644 --- a/gl/m4/ssize_t.m4 +++ b/gl/m4/ssize_t.m4 | |||
@@ -1,23 +1,38 @@ | |||
1 | # ssize_t.m4 serial 5 (gettext-0.18.2) | 1 | # ssize_t.m4 |
2 | dnl Copyright (C) 2001-2003, 2006, 2010-2023 Free Software Foundation, Inc. | 2 | # serial 6 |
3 | dnl Copyright (C) 2001-2003, 2006, 2010-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
6 | 7 | ||
7 | dnl From Bruno Haible. | 8 | dnl From Bruno Haible. |
8 | dnl Test whether ssize_t is defined. | 9 | dnl Define ssize_t if it does not already exist. |
9 | 10 | ||
10 | AC_DEFUN([gt_TYPE_SSIZE_T], | 11 | AC_DEFUN([gt_TYPE_SSIZE_T], |
11 | [ | 12 | [ |
12 | AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t], | 13 | AC_CACHE_CHECK([for ssize_t], [gl_cv_ssize_t], |
13 | [AC_COMPILE_IFELSE( | 14 | [AC_COMPILE_IFELSE( |
14 | [AC_LANG_PROGRAM( | 15 | [AC_LANG_PROGRAM( |
15 | [[#include <sys/types.h>]], | 16 | [[#include <sys/types.h>]], |
16 | [[int x = sizeof (ssize_t *) + sizeof (ssize_t); | 17 | [[int x = sizeof (ssize_t *) + sizeof (ssize_t); |
17 | return !x;]])], | 18 | return !x;]])], |
18 | [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])]) | 19 | [gl_cv_ssize_t=yes], [gl_cv_ssize_t=no])]) |
19 | if test $gt_cv_ssize_t = no; then | 20 | if test $gl_cv_ssize_t = no; then |
20 | AC_DEFINE([ssize_t], [int], | 21 | dnl On 64-bit native Windows, ssize_t needs to be defined as 'long long', |
21 | [Define as a signed type of the same size as size_t.]) | 22 | dnl for consistency with the 64-bit size_t. |
23 | AC_CACHE_CHECK([whether size_t is wider than 'long'], [gl_cv_size_t_large], | ||
24 | [AC_COMPILE_IFELSE( | ||
25 | [AC_LANG_PROGRAM( | ||
26 | [[#include <sys/types.h> | ||
27 | typedef int array [2 * (sizeof (size_t) > sizeof (long)) - 1]; | ||
28 | ]])], | ||
29 | [gl_cv_size_t_large=yes], [gl_cv_size_t_large=no])]) | ||
30 | if test $gl_cv_size_t_large = yes; then | ||
31 | gl_def_ssize_t='long long' | ||
32 | else | ||
33 | gl_def_ssize_t='long' | ||
34 | fi | ||
35 | AC_DEFINE_UNQUOTED([ssize_t], [$gl_def_ssize_t], | ||
36 | [Define as a signed type of the same size as size_t.]) | ||
22 | fi | 37 | fi |
23 | ]) | 38 | ]) |