Fixed libraries includes in Sconstruct files

The order when including the libraries is important, even if 'dl' is included it must appear after 'check' in the LIBS variable, if not the check libraries are not able to see 'dl'.
It also happens with -l<libname> in makefiles.

Here libdl can not see libz objects.

LIBS = ['check', 'common', 'curl', 'm', 'z', 'dl', 'rt']