apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Rossi <bob_ro...@cox.net>
Subject Re: building apr on cygwin for mingw
Date Wed, 06 Dec 2006 03:37:21 GMT
On Wed, Dec 06, 2006 at 02:24:16PM +1100, John Vandenberg wrote:
> On 12/2/06, Bob Rossi <bob_rossi@cox.net> wrote:
> >Hi,
> >
> >...
> >
> >Secondly, the APR_CHECK_SIZEOF_EXTENDED isn't working for me because the
> >default for the cross compiled size is 8. However, ssize_t for me is 4.
> >So, the configure fails. I made this change:
> >
> >  -APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
> >  +AC_CHECK_SIZEOF([ssize_t], [#include <stdio.h>
> >  +#include <sys/types.h>])
> >
> >and things work nicely. Would a patch like this be acceptable? There are
> >5 changes I made just like this. Finally, the macro
> >APR_CHECK_SIZEOF_EXTENDED could probably be removed.
> This makes sense.  Apr currently depends on autoconf 2.50; in that
> release AC_CHECK_SIZEOF was enhanced to determine the size without
> using AC_TRY_RUN.  In order to replace APR_CHECK_SIZEOF_EXTENDED, we
> need to verify that AC_CHECK_SIZEOF supports non-builtin types.  I was
> able to successfully replace APR_CHECK_SIZEOF_EXTENDED with
> AC_CHECK_SIZEOF in conjunction with autoconf 2.53 and 2.59 on Fedora
> Core 3, however I was unable to build autoconf 2.50 or 2.52 on my FC3
> box, so further verification is needed.

OK, sounds great. There currently is a bug in AC_CHECK_SIZEOF in all
released version of autoconf. I obviously do not see this as an apr
issue. The bug was patched upstream because of the problem I found trying 
to cross compile apr from cygwin to mingw. The problem is that
AC_CHECK_SIZEOF used to do 
  FILE *f=fopen("conftestval", "w");
  if (!f) exit(1);
  fprintf(f, "%d\n", sizeof($2));
but was modified to
  FILE *f=fopen("conftestval", "w");
  if (!f) exit(1);
  fprintf(f, "%d", sizeof($2));
Basically, the \n was removed. This is because it would write a \r\n on
windows. The macro would then cat the file and get back '4\r', which 
would not be an acceptable value.

I'm pretty sure this change would be acceptable to make to
APR_CHECK_SIZEOF_EXTENDED, regardless of it the macro is replaced with 

Bob Rossi

View raw message