On Wed, Mar 13, 2019 at 9:33 PM Jim Jagielski <j...@jagunet.com> wrote: > > Just a FYI that compiling httpd trunk (HEAD) against apr-1.7 (HEAD) and > apu-1.6 (HEAD), I get no error messages about APR_OFF_T_FMT issues, so I'm > not exactly sure where these are coming from for macOS
Possibly to resolve APR_<INTTYPE>_T_FMT on system with [std]int[types].h, we could bind to the standard (C99?) format PR[dxo..]N, especially since we configure the format based off $ac_cv_sizeof_<inttype>, so something like: #define APR_<INTTYPE>_T_FMT PR[dxo..]`expr $ac_cv_sizeof_<inttype>_t * 8` That should work on most "modern" systems/compilers (including -stdc=c89), no? And for older ones the current as fallback could be reasonable.. The attached patch is a first try with off_t (not "technically" an inttype but same kind), could be generalized to inttypes ([s]size_t, ptrdiff_t, ..) if it suvives some tests on systems we support/can; seems to work on my linux(es) building httpd --maintainer-mode --with-included-apr at least. E.g. in my generated apr.h: #define APR_OFF_T_FMT PRId64 Can of worms?
Index: srclib/apr/build/apr_common.m4 =================================================================== --- srclib/apr/build/apr_common.m4 (revision 1800753) +++ srclib/apr/build/apr_common.m4 (working copy) @@ -477,7 +477,7 @@ main() { FILE *f=fopen("conftestval", "w" binmode); if (!f) exit(1); - fprintf(f, "%d\n", sizeof($2)); + fprintf(f, "%d\n", (int)sizeof($2)); exit(0); }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$3],,, AC_CV_NAME=$3))])dnl Index: srclib/apr/configure.in =================================================================== --- srclib/apr/configure.in (revision 1800753) +++ srclib/apr/configure.in (working copy) @@ -1477,6 +1477,7 @@ APR_FLAG_HEADERS( errno.h \ fcntl.h \ grp.h \ + inttypes.h \ io.h \ limits.h \ mach-o/dyld.h \ @@ -1556,6 +1557,7 @@ AC_SUBST(crypth) AC_SUBST(errnoh) AC_SUBST(direnth) AC_SUBST(fcntlh) +AC_SUBST(inttypesh) AC_SUBST(ioh) AC_SUBST(limitsh) AC_SUBST(netdbh) @@ -1904,17 +1906,31 @@ 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"' - 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' + if test "$inttypesh" = "1"; then + off_t_bits=`expr $ac_cv_sizeof_off_t \* 8` + off_t_fmt="#define APR_OFF_T_FMT PRId$off_t_bits" + if test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long"; then + off_t_strfn='strtol' + elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_int"; then + off_t_strfn='strtoi' + elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long_long"; then + off_t_strfn='strtoll' + else + AC_ERROR([could not determine the string convertion to off_t]) + fi else - AC_ERROR([could not determine the size of off_t]) + if 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 "lld"' + off_t_strfn='strtoll' + else + AC_ERROR([could not determine the format of off_t]) + fi fi # Per OS tuning... case $host in @@ -1927,7 +1943,7 @@ elif test "$ac_cv_type_off_t" = "yes"; then else # Fallback on int off_t_value=apr_int32_t - off_t_fmt=d + off_t_fmt='#define APR_OFF_T_FMT "d"' off_t_strfn='strtoi' fi AC_MSG_RESULT($off_t_value) Index: srclib/apr/include/apr.h.in =================================================================== --- srclib/apr/include/apr.h.in (revision 1800753) +++ srclib/apr/include/apr.h.in (working copy) @@ -93,6 +93,7 @@ #define APR_HAVE_STDLIB_H @stdlibh@ #define APR_HAVE_STRING_H @stringh@ #define APR_HAVE_STRINGS_H @stringsh@ +#define APR_HAVE_INTTYPES_H @inttypesh@ #define APR_HAVE_SYS_IOCTL_H @sys_ioctlh@ #define APR_HAVE_SYS_SENDFILE_H @sys_sendfileh@ #define APR_HAVE_SYS_SIGNAL_H @sys_signalh@ @@ -178,6 +179,11 @@ #include <stdint.h> #endif +#if APR_HAVE_INTTYPES_H +/* PR[diuxo]N formats */ +#include <inttypes.h> +#endif + #if APR_HAVE_SYS_WAIT_H #include <sys/wait.h> #endif