Link against glib if glib if necessary.

Done-with: Carsten Munk <carsten.munk@jollamobile.com>