I'm unable to build apr with mingw >= 4.8.2. The mingw shipped with Qt 4.8.0 works just fine, however mingw 4.8.2 is shipped with Qt 5.x and doesn't work. I have tried a more recent build of mingw outside of Qt i686-4.9.0-release-posix-sjlj-rt_v3-rev2.7z from:
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.0/threads-posix/sjlj/ with the same results.
Attached you will find my build script and the build log. It appears that there is a problem with the header files distributed with mingw.
This is building apr-1.4.6 from https://apr.apache.org/.
The working version of mingw has gcc 4.7.3.
Here's a log from the same build with gcc 4.7.3 that works. I notice in the configure output the 4.7.3 version uses func_cygming_dll_for_implib_fallback for runtime link libraries, but the 4.9.0 version uses func_cygming_dll_for_implib.
I also see that 4.9.0 supports atomic builtins and 4.7.3 does not. ssize_t apparently has changed typedefs as well. And there are some differences in threading support.
Problem solved. It's a bug in apr. They are defining wtypes_h instead of including wtypes.h. I will file a bug with them.
Closing as invalid.