On Dec 16, 2010, at 3:23 PM, Jim Jagielski wrote:
>
> Here is my idea... currently, when looking for sizes
> and formats for off_t, we do from smallest to largest
> (int -> long -> long long). We also do the same when
> checking apr_int64_t as well...
>
> What if we do the reverse? What if instead of finding
> the smallest that is the right size, we find the first,
> starting with the longest?
>
> I'm trying that out now, so we'll see...
>
hey.... this looks promising! With this, APR and httpd
builds with no "warning ... expect" errors at all, and
passes the test framework, no matter is built forcing 64bit,
32bit *or universal*!
Please check over because I hope to commit sometimes
tomorrow!!
Index: configure.in
===================================================================
--- configure.in (revision 1050141)
+++ configure.in (working copy)
@@ -1526,24 +1526,15 @@
fi
# Now we need to find what apr_int64_t (sizeof == 8) will be.
# The first match is our preference.
-if test "$ac_cv_sizeof_int" = "8"; then
- int64_literal='#define APR_INT64_C(val) (val)'
- uint64_literal='#define APR_UINT64_C(val) (val##U)'
- int64_t_fmt='#define APR_INT64_T_FMT "d"'
- uint64_t_fmt='#define APR_UINT64_T_FMT "u"'
- uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "x"'
- 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"
+if 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)'
+ int64_t_fmt='#define APR_INT64_T_FMT "qd"'
+ uint64_t_fmt='#define APR_UINT64_T_FMT "qu"'
+ uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "qx"'
+ int64_value="__int64"
+ long_value="__int64"
+ int64_strfn="strtoll"
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)'
@@ -1557,15 +1548,24 @@
int64_value="long long"
long_value="long long"
int64_strfn="strtoll"
-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)'
- int64_t_fmt='#define APR_INT64_T_FMT "qd"'
- uint64_t_fmt='#define APR_UINT64_T_FMT "qu"'
- uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "qx"'
- int64_value="__int64"
- long_value="__int64"
- 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_int" = "8"; then
+ int64_literal='#define APR_INT64_C(val) (val)'
+ uint64_literal='#define APR_UINT64_C(val) (val##U)'
+ int64_t_fmt='#define APR_INT64_T_FMT "d"'
+ uint64_t_fmt='#define APR_UINT64_T_FMT "u"'
+ uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "x"'
+ int64_value="int"
+ long_value=int
+ int64_strfn="strtoi"
else
# int64_literal may be overriden if your compiler thinks you have
# a 64-bit value but APR does not agree.
@@ -1749,16 +1749,17 @@
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
+ # where int and long are the same size. Use the longest
+ # type that fits
+ 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