1 | #serial 4
|
---|
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_INTMAX_T])
|
---|
8 | AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
|
---|
9 | AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
|
---|
10 | AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
|
---|
11 | AC_CHECK_DECLS([strtol, strtoul, strtoull, strtoimax, strtoumax])
|
---|
12 | AC_CHECK_HEADERS(limits.h stdlib.h inttypes.h)
|
---|
13 |
|
---|
14 | AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
|
---|
15 | jm_cv_func_strtoumax_macro,
|
---|
16 | AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
|
---|
17 | #ifdef strtoumax
|
---|
18 | inttypes_h_defines_strtoumax
|
---|
19 | #endif],
|
---|
20 | jm_cv_func_strtoumax_macro=yes,
|
---|
21 | jm_cv_func_strtoumax_macro=no))
|
---|
22 |
|
---|
23 | if test "$jm_cv_func_strtoumax_macro" != yes; then
|
---|
24 | AC_REPLACE_FUNCS(strtoumax)
|
---|
25 | fi
|
---|
26 |
|
---|
27 | dnl Only the replacement strtoumax invokes strtoul and strtoull,
|
---|
28 | dnl so we need the replacements only if strtoumax does not exist.
|
---|
29 | case "$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
|
---|
30 | no,no)
|
---|
31 | AC_REPLACE_FUNCS(strtoul)
|
---|
32 |
|
---|
33 | dnl We don't need (and can't compile) the replacement strtoull
|
---|
34 | dnl unless the type `unsigned long long' exists.
|
---|
35 | if test "$ac_cv_type_unsigned_long_long" = yes; then
|
---|
36 | AC_REPLACE_FUNCS(strtoull)
|
---|
37 | fi
|
---|
38 | ;;
|
---|
39 | esac
|
---|
40 | ])
|
---|