move gnulib and own include after system headers

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
build-sys: add libtool thread library linking hint

Suggested by ./bootstrap script.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>