On Sun, Dec 16, 2018 at 03:57:40PM -0000, Christian Weisgerber wrote:
> On 2018-12-16, Stefan Sperling <[email protected]> wrote:
> 
> > APR's configure script figures out that off_t is 'long long' on
> > OpenBSD but at the same time sets APR_OFF_T_FMT to "ld".
> 
> That sounds like a generic problem that should be fixed generically...
> 
> > I suspect we should add OS-specific overrides to APR's configure script.
> 
> ... rather than using OS overrides.

I am kind of afraid that they will say their existing order of checks
is intended and that we should add an OS override.
Another possible fix for us would be to move the check for 'long long'
before the one for 'long' (see below) but I don't know what upstream
would say about that.

> *Looks into apr configure script*
> Sigh.  Unfortunately this is all based on sizeof(type1)==sizeof(type2)
> rather than type1 and type2 being the same.

Yeah it's quite horrible.

> > The patch below does this and fixes the above error. Am I right that this
> > is what the script should be doing for all OpenBSD architectures?
> 
> Yes.  off_t is long long on all our archs.

Good to know.

Index: configure.in
===================================================================
--- configure.in        (revision 1849023)
+++ configure.in        (working copy)
@@ -1613,15 +1613,6 @@ if test "$ac_cv_sizeof_int" = "8"; then
     int64_value="int"
     long_value=int
     int64_strfn="strtoi"
-elif test "$ac_cv_sizeof_long" = "8"; then
-    int64_literal='#define APR_INT64_C(val) (val##L)'
-    uint64_literal='#define APR_UINT64_C(val) (val##UL)'
-    int64_t_fmt='#define APR_INT64_T_FMT "ld"'
-    uint64_t_fmt='#define APR_UINT64_T_FMT "lu"'
-    uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "lx"'
-    int64_value="long"
-    long_value=long
-    int64_strfn="strtol"
 elif test "$ac_cv_sizeof_long_long" = "8"; then
     int64_literal='#define APR_INT64_C(val) (val##LL)'
     uint64_literal='#define APR_UINT64_C(val) (val##ULL)'
@@ -1635,6 +1626,15 @@ elif test "$ac_cv_sizeof_long_long" = "8"; then
     int64_value="long long"
     long_value="long long"
     int64_strfn="strtoll"
+elif test "$ac_cv_sizeof_long" = "8"; then
+    int64_literal='#define APR_INT64_C(val) (val##L)'
+    uint64_literal='#define APR_UINT64_C(val) (val##UL)'
+    int64_t_fmt='#define APR_INT64_T_FMT "ld"'
+    uint64_t_fmt='#define APR_UINT64_T_FMT "lu"'
+    uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "lx"'
+    int64_value="long"
+    long_value=long
+    int64_strfn="strtol"
 elif test "$ac_cv_sizeof_longlong" = "8"; then
     int64_literal='#define APR_INT64_C(val) (val##LL)'
     uint64_literal='#define APR_UINT64_C(val) (val##ULL)'
@@ -1847,15 +1847,15 @@ elif test "$ac_cv_type_off_t" = "yes"; then
     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
+    if test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long_long"; then
+        off_t_fmt='#define APR_OFF_T_FMT APR_INT64_T_FMT'
+        off_t_strfn='apr_strtoi64'
+    elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long"; then
         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"'
         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'
-        off_t_strfn='apr_strtoi64'
     else
         AC_ERROR([could not determine the size of off_t])
     fi

Reply via email to