Fix script flaw in detection of best team when sending achievement info

--HG--
extra : transplant_source : %0D%CE%FF%BA%A4%EEg%B1%9E%9C%A9%B4%E2W%0EV%F4WGm
this should prevent duplication of CMAKE_Pascal_FLAGS
fix shared library loading by using the right variable

--HG--
extra : histedit_source : ea6b3cd2886ad4865180284fc38ddca0046bc1d2
make sure that linker flags are picked by the pascal rule
avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found