| 1 |
# strtoull.m4 |
| 2 |
# serial 11 |
| 3 |
dnl Copyright (C) 2002, 2004, 2006, 2008-2025 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 |
dnl This file is offered as-is, without any warranty. |
| 8 |
|
| 9 |
AC_DEFUN([gl_FUNC_STRTOULL], |
| 10 |
[ |
| 11 |
AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
| 12 |
AC_REQUIRE([AC_CANONICAL_HOST]) |
| 13 |
AC_CHECK_FUNCS([strtoull]) |
| 14 |
if test $ac_cv_func_strtoull = yes; then |
| 15 |
AC_CACHE_CHECK([whether strtoull works], |
| 16 |
[gl_cv_func_strtoull_works], |
| 17 |
[AC_RUN_IFELSE( |
| 18 |
[AC_LANG_PROGRAM( |
| 19 |
[[#include <stdlib.h>]], |
| 20 |
[[int result = 0; |
| 21 |
char *term; |
| 22 |
/* This test fails on Minix and native Windows. */ |
| 23 |
{ |
| 24 |
const char input[] = "0x"; |
| 25 |
(void) strtoull (input, &term, 16); |
| 26 |
if (term != input + 1) |
| 27 |
result |= 1; |
| 28 |
} |
| 29 |
/* This test fails on pre-C23 platforms. */ |
| 30 |
{ |
| 31 |
const char input[] = "0b1"; |
| 32 |
(void) strtoull (input, &term, 2); |
| 33 |
if (term != input + 3) |
| 34 |
result |= 2; |
| 35 |
} |
| 36 |
return result; |
| 37 |
]]) |
| 38 |
], |
| 39 |
[gl_cv_func_strtoull_works=yes], |
| 40 |
[gl_cv_func_strtoull_works=no], |
| 41 |
[case "$host_os" in |
| 42 |
# Guess no on native Windows. |
| 43 |
mingw* | windows*) gl_cv_func_strtoull_works="guessing no" ;; |
| 44 |
# Guess no on glibc systems. |
| 45 |
*-gnu* | gnu*) gl_cv_func_strtoull_works="guessing no" ;; |
| 46 |
# Guess no on musl systems. |
| 47 |
*-musl* | midipix*) gl_cv_func_strtoull_works="guessing no" ;; |
| 48 |
*) gl_cv_func_strtoull_works="$gl_cross_guess_normal" ;; |
| 49 |
esac |
| 50 |
]) |
| 51 |
]) |
| 52 |
case "$gl_cv_func_strtoull_works" in |
| 53 |
*yes) ;; |
| 54 |
*) REPLACE_STRTOULL=1 ;; |
| 55 |
esac |
| 56 |
else |
| 57 |
HAVE_STRTOULL=0 |
| 58 |
fi |
| 59 |
]) |
| 60 |
|
| 61 |
# Prerequisites of lib/strtoull.c. |
| 62 |
AC_DEFUN([gl_PREREQ_STRTOULL], [ |
| 63 |
: |
| 64 |
]) |