]> Dogcows Code - chaz/tar/blob - m4/xstrtoumax.m4
838a5018c33899f66f88c7da4c14b8cabef08b00
[chaz/tar] / m4 / xstrtoumax.m4
1 #serial 3
2
3 # autoconf tests required for use of xstrtoumax.c
4
5 AC_DEFUN(jm_AC_PREREQ_XSTRTOUMAX,
6 [
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)
11
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>
15 #ifdef strtoumax
16 inttypes_h_defines_strtoumax
17 #endif],
18 jm_cv_func_strtoumax_macro=yes,
19 jm_cv_func_strtoumax_macro=no))
20
21 if test "$jm_cv_func_strtoumax_macro" != yes; then
22 AC_REPLACE_FUNCS(strtoumax)
23 fi
24
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
30 yes,no,no)
31 AC_REPLACE_FUNCS(strtoull strtol)
32 ;;
33 esac
34
35 case "$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
36 no,no)
37 AC_REPLACE_FUNCS(strtoul strtol)
38 ;;
39 esac
40
41 ])
This page took 0.035071 seconds and 4 git commands to generate.