2 dnl Cloned from xstrtoumax.m4. Keep these files in sync.
4 # autoconf tests required for use of xstrtoimax.c
6 AC_DEFUN([jm_AC_PREREQ_XSTRTOIMAX],
8 AC_REQUIRE([jm_AC_TYPE_INTMAX_T])
9 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
10 AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
11 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
12 AC_CHECK_DECLS([strtol, strtoul, strtoll, strtoimax, strtoumax])
13 AC_CHECK_HEADERS(limits.h stdlib.h inttypes.h)
15 AC_CACHE_CHECK([whether <inttypes.h> defines strtoimax as a macro],
16 jm_cv_func_strtoimax_macro,
17 AC_EGREP_CPP([inttypes_h_defines_strtoimax], [#include <inttypes.h>
19 inttypes_h_defines_strtoimax
21 jm_cv_func_strtoimax_macro=yes,
22 jm_cv_func_strtoimax_macro=no))
24 if test "$jm_cv_func_strtoimax_macro" != yes; then
25 AC_REPLACE_FUNCS(strtoimax)
28 dnl Only the replacement strtoimax invokes strtol and strtoll,
29 dnl so we need the replacements only if strtoimax does not exist.
30 case "$jm_cv_func_strtoimax_macro,$ac_cv_func_strtoimax" in
32 AC_REPLACE_FUNCS(strtol)
34 dnl We don't need (and can't compile) the replacement strtoll
35 dnl unless the type `long long' exists.
36 if test "$ac_cv_type_long_long" = yes; then
37 AC_REPLACE_FUNCS(strtoll)