I'm not aware of a direct way to list all the possible flags for different software. With
brew options [formula] you can list the build flags you can use directly with
brew install. These options are defined in the
Formula of the software and you can inspect it with
brew edit [formula] (e.g.
brew edit gcc48 and search for
However, at least with
gcc (and any software that uses Autoconf), you can list all possible flags by following the steps below.
brew install -i gcc48 to get a shell with the package to be installed extracted to a temporary directory. From there, you can use
./configure --help to list all possible flags for the particular software.
If you want to use some of the flags not possible with
brew, you can proceed as you would with a normal installation without
./configure [flags]; make; make install). After that, when you
brew should pick up the finished build and you are done.
If you just
exit after taking a look at the
brew notices that the there is nothing to be installed and exits with an error ("Error: Empty installation"). The same happens when there is some error in the actual build process ("Aborting due to non-zero exit status").