Configuring Tor with --with*dir gives wrong directories

I'm trying to configure Tor like this:

./configure --enable-gcc-warnings --with-openssl-dir=/opt/local --with-zlib-dir=/usr --with-libevent-dir=/usr/local

What happens is that the zlib.h that gets included is from /opt/local/include, instead of the one in /usr/include.

During configure, I get this as output, though:

checking for zlib directory... /usr/include checking whether we need extra options to link zlib... (none)

[Automatically added by flyspray2trac: Operating System: All]