Debian Codegraph @

m4/strtoll.m4

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