Allow passing extra flags to configure with depends builds.

For #3802