configure fails on my system (FreeBSD 10.0-CURRENT) with error:
checking for XSetErrorHandler in -lX11... yes
checking for gzopen in -lz... yes
checking for dlopen in -ldl... no
configure: error: Failed to find required dl library
===> Script "configure" failed unexpectedly.
This is due wrong assumption that dlopen(3) function is located in dl library. On FreeBSD (other BSDs probably too) systems dlopen(3) is part of libc as documented here:
Attached patch fixes issue for me.