Link against glib if necessary.

Change-Id: Ie0f87c24d15a6784cc9ed1201d3578ffbf94d191
Done-with: Carsten Munk <carsten.munk@jollamobile.com>
Reviewed-by: Andrew Knight <andrew.knight@digia.com>