Fix linker flags with clang, close #5820

Use --{start,end}-group to link objects in correct order. Also use -B{dynamic,static} switches to link static libraries as "static libraries".

see also: https://svn.boost.org/trac/boost/ticket/5820