3 # autoconf tests required for use of xstrtoumax.c
5 AC_DEFUN(jm_AC_PREREQ_XSTRTOUMAX,
7 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
8 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
9 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
10 AC_CHECK_DECLS([strtoul, strtoull])
11 AC_CHECK_HEADERS(limits.h stdlib.h)
13 AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
14 jm_cv_func_strtoumax_macro,
15 AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
17 inttypes_h_defines_strtoumax
19 jm_cv_func_strtoumax_macro=yes,
20 jm_cv_func_strtoumax_macro=no))
22 if test "$jm_cv_func_strtoumax_macro" != yes; then
23 AC_REPLACE_FUNCS(strtoumax)
26 dnl We don't need (and can't compile) the replacement strtoull
27 dnl unless the type `unsigned long long' exists.
28 dnl Also, only the replacement strtoumax invokes strtoull,
29 dnl so we need the replacement strtoull only if strtoumax does not exist.
30 case "$ac_cv_type_unsigned_long_long,$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
32 AC_REPLACE_FUNCS(strtoull strtol)
36 case "$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
38 AC_REPLACE_FUNCS(strtoul strtol)