diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2019-03-19 15:27:33 +0000 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2019-03-19 15:27:33 +0000 |
commit | 29fddf0f76ca3f7efdb66616c7e74b1344cd1258 (patch) | |
tree | 0fbbe348f1497f133c04232d7d58298b0f43bb45 /configure.in | |
parent | 9b68bfe5311d0ce48b47cc9c7765259dab47dea2 (diff) | |
download | apr-29fddf0f76ca3f7efdb66616c7e74b1344cd1258.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/branches/1.7.x@1855844 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 b5c50ef19..b59e8f8a2 100644 --- a/configure.in +++ b/configure.in @@ -1922,21 +1922,24 @@ elif test "${ac_cv_sizeof_off_t}x${ac_cv_sizeof_long}" = "4x4"; then off_t_fmt='#define APR_OFF_T_FMT "ld"' off_t_strfn='strtol' elif test "$ac_cv_type_off_t" = "yes"; then - off_t_value=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"' + # where int and long are the same size and interchangable. + off_t_value=off_t + 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*) @@ -1944,7 +1947,11 @@ elif test "$ac_cv_type_off_t" = "yes"; then off_t_fmt='#define APR_OFF_T_FMT "I64d"' off_t_strfn='_strtoi64' ;; + *) + AC_ERROR([could not determine the size of off_t]) + ;; esac + ])])])]) else # Fallback on int off_t_value=apr_int32_t |