Fix flex for building on darwin systems
Merge pull request #2277 from jwiegley/flex

Fix flex for building on darwin systems