Fixes/tweaks for compilation under Arch Linux

Mostly related to properly linking legacy libelf without conflicting with system's libelf

There is also a conflict related to linking flex in xclnm, and the only solution I found is _not_ to link it. I do not have another platform to test this, but I think it's related to newer versions of flex changing "yylex" behavioir. I've left this as a separate commit so it can be left out of the merge if '-lfl' is needed in that case.