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_TYPE_UNSIGNED_LONG_LONG])
9 AC_CHECK_DECLS([strtoul, strtoull])
10 AC_CHECK_HEADERS(limits.h stdlib.h inttypes.h)
12 AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
13 jm_cv_func_strtoumax_macro,
14 AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
16 inttypes_h_defines_strtoumax
18 jm_cv_func_strtoumax_macro=yes,
19 jm_cv_func_strtoumax_macro=no))
21 if test "$jm_cv_func_strtoumax_macro" != yes; then
22 AC_REPLACE_FUNCS(strtoumax)
25 dnl We don't need (and can't compile) the replacement strtoull
26 dnl unless the type `unsigned long long' exists.
27 dnl Also, only the replacement strtoumax invokes strtoull,
28 dnl so we need the replacement strtoull only if strtoumax does not exist.
29 case "$ac_cv_type_unsigned_long_long,$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
31 AC_REPLACE_FUNCS(strtoull strtol)
35 case "$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
37 AC_REPLACE_FUNCS(strtoul strtol)