check integer overflows in scalarmath

also improve buildsystem to allow generated headers