Moved check for libdl before the check for libhdf5.  This way, when working with static libraries, libdl will be used when compiling the libhdf5 test program.