You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2019/03/19 15:16:29 UTC

svn commit: r1855840 - /apr/apr/trunk/configure.in

Author: wrowe
Date: Tue Mar 19 15:16:29 2019
New Revision: 1855840

URL: http://svn.apache.org/viewvc?rev=1855840&view=rev
Log:
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.


Modified:
    apr/apr/trunk/configure.in

Modified: apr/apr/trunk/configure.in
URL: http://svn.apache.org/viewvc/apr/apr/trunk/configure.in?rev=1855840&r1=1855839&r2=1855840&view=diff
==============================================================================
--- apr/apr/trunk/configure.in (original)
+++ apr/apr/trunk/configure.in Tue Mar 19 15:16:29 2019
@@ -1851,22 +1851,25 @@ elif test "${ac_cv_sizeof_off_t}x${ac_cv
     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"; t
         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