add --enable-threads support
add stdout/err forwarding code