*Big* difference between mingw and cygwin.
For mingw, yes, the win32 code needs to be selected in appropriately, because mingw isn't really a compat layer - rather it's the GNU toolchain running on undisguised Windows.
On Cygwin, however, apr works very nicely built in unix mode - both Apache 2 and Subversion both work on Cygwin with minimal tweaking - and indeed it would be fatal to try and make apr use the win32 code on cygwin, since it would break cygwin's unixy abstractions for apr's client programs.
I've got APR building using Ant + cpptasks for both MS and Borland compilers since those compilers are of interest to log4cxx users and log4cxx now uses APR. The build files are in the log4cxx CVS (apr-build.xml etc). MinGW is next on my list. I haven't attempted it but it might work out of the box. You could try:
Install ant-1.6.2 (http://ant.apache.org)
Build cpptasks and ant-contrib from CVS HEAD (http://sf.net/projects/ant-contrib)
Place cpptasks.jar and ant-contrib.jar on classpath
checkout logging-log4cxx from Apache CVS
cd logging-log4cxx
Place MinGW toolkit on path
ant -Dcompiler=gcc
which will attempt to download APR 1.1.0 from a mirror, apply patches to allow it to compile with the Borland toolchain, build apr, apr-iconv, apr-util and log4cxx.
If you are just interested in APR and don't want to apply the Borland fixes, copy apr-build.xml to build.xml in the APR directory and run "ant -Dcompiler=gcc"
