Handle --disable-foo properly

Fixes #1253