Determine flags that were given for packages installed with homebrew
When a package is built from source the flags that were used to build are shown when you do brew info &lt;package&gt;.

In this case: brew info emacs | grep "Built from source"