Additional library checks and adjust compile options for OpenBSD
remove leftover ")"
put the "(" back where it belonged
another ")"
and another spurious ")" got in there
reorder some ifs