Don't call imlib_context_free when context is NULL

This silences a silly imlib error, which might be thrown if conky exits
before imlib has been initialized properly (e.g. when no useable config
is found). Given the length of the error and the feigned severity,
people would miss the actual issue.
Fix test for ncurses in configure

First check the header, then the lib, and only then define NCURSES. This
matters because it is enabled by default and it being missing would be
an error. If something is missing and enabled by default but not
required, it should just silently be disabled instead.
Fix header pollution through llua.h

conky.h does not need anything from llua.h, but was missed with 710a390,
this include is moved to conky.c and llua.c.
llua.h does not need anything from X11.h, so this include is moved to
llua.c.