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