diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2019-03-19 15:16:29 +0000 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2019-03-19 15:16:29 +0000 |
commit | f88ed2559a0f85c893144388f4451127491e7acd (patch) | |
tree | af445652b2ac2a7c1b4f253ae6996c971896c724 /configure.in | |
parent | a69bca5908f1cbc65528eb5fe6811e1ebb6fd7f2 (diff) | |
download | apr-f88ed2559a0f85c893144388f4451127491e7acd.tar.gz |
Replace generic off_t logic with APR_CHECK_TYPES_FMT_COMPATIBLE,
confirming that the best int type is elected for off_t, even where
the bytewidth of multiple int types is identical. Resolves issues
around APR_OFF_T_FMT reported on modern BSD compilers.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1855840 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/configure.in b/configure.in index b84fa37d3..4a0ef8293 100644 --- a/configure.in +++ b/configure.in @@ -1851,22 +1851,25 @@ elif test "${ac_cv_sizeof_off_t}x${ac_cv_sizeof_long}" = "4x4"; then off_t_strfn='strtol' off_t_size="$ac_cv_sizeof_long" elif test "$ac_cv_type_off_t" = "yes"; then + # off_t is more commonly a long than an int; prefer that case + # where int and long are the same size and interchangable. off_t_value=off_t off_t_size="$ac_cv_sizeof_off_t" - # off_t is more commonly a long than an int; prefer that case - # where int and long are the same size. - if test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long"; then - off_t_fmt='#define APR_OFF_T_FMT "ld"' + APR_CHECK_TYPES_FMT_COMPATIBLE(off_t, long, ld, [ + off_t_fmt="#define APR_OFF_T_FMT \"ld\"" off_t_strfn='strtol' - elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_int"; then - off_t_fmt='#define APR_OFF_T_FMT "d"' + ], [ + APR_CHECK_TYPES_FMT_COMPATIBLE(off_t, int, d, [ + off_t_fmt="#define APR_OFF_T_FMT \"d\"" off_t_strfn='strtoi' - elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long_long"; then - off_t_fmt='#define APR_OFF_T_FMT APR_INT64_T_FMT' + ], [ + APR_CHECK_TYPES_FMT_COMPATIBLE(off_t, long long, lld, [ + off_t_fmt="#define APR_OFF_T_FMT \"lld\"" off_t_strfn='apr_strtoi64' - else - AC_ERROR([could not determine the size of off_t]) - fi + ], [ + APR_CHECK_TYPES_FMT_COMPATIBLE(off_t, $int64_value, I64d, [ + off_t_fmt="#define APR_OFF_T_FMT APR_INT64_T_FMT" + off_t_strfn='apr_strtoi64'], [ # Per OS tuning... case $host in *-mingw*) @@ -1875,7 +1878,11 @@ elif test "$ac_cv_type_off_t" = "yes"; then off_t_strfn='_strtoi64' off_t_size=8 ;; + *) + AC_ERROR([could not determine the size of off_t]) + ;; esac + ])])])]) else # Fallback on int off_t_value=int |