]> Dogcows Code - chaz/tar/blob - m4/xstrtoumax.m4
serial 3
[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_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)
12
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>
16 #ifdef strtoumax
17 inttypes_h_defines_strtoumax
18 #endif],
19 jm_cv_func_strtoumax_macro=yes,
20 jm_cv_func_strtoumax_macro=no))
21
22 if test "$jm_cv_func_strtoumax_macro" != yes; then
23 AC_REPLACE_FUNCS(strtoumax)
24 fi
25
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
31 yes,no,no)
32 AC_REPLACE_FUNCS(strtoull strtol)
33 ;;
34 esac
35
36 case "$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
37 no,no)
38 AC_REPLACE_FUNCS(strtoul strtol)
39 ;;
40 esac
41
42 ])
This page took 0.039846 seconds and 4 git commands to generate.