3 Answers
3

If the portage package manager is used (it most likely is) then the CPU flags can be found in /etc/make.conf as CFLAGS and CXXFLAGS. Note that individual ebuilds may filter certain flags, so the flags you see in /etc/make.conf may not be the ones that were used to compile the package. Looking at the ebuild (under /usr/portage/<category name>/<program name>/) might tell you if that is the case.

This assumes of course that the contents of /etc/make.conf weren't changed after the compilation of the package.

Please be aware that current USE flags and other configuration defined in /etc/make.conf may have changed since the package was installed. A more reliable way of checking configuration and compile options is to check var/db/pkg.

It is important to note that make.conf is not reliable at all, to check how a package is compiled. In fact, it is just one of the supplementary config files in a whole list.

From the man make.conf:

USE_ORDER = "env:pkg:conf:defaults:pkginternal:repo:env.d"
Determines the precedence of layers in the incremental stacking of the USE
variable. Precedence decreases from left to right such that env overrides
pkg, pkg overrides conf, and so forth.

So the priority is handled as:

Shell environment when calling emerge

Package specific USE setting in /etc/portage/package.use

make.conf

Defaults from selected profile

Defaults set in package .ebuild file

Distribution defaults

Settings defined in /etc/env.d

So basically an USE flags can be set without being mentioned in make.conf. Likewise for CFLAGS (although their order of processing is fixed, but it works similar)

Likewise, USE flags can be masked in a profile without any in the ebuild or any other sources mentioned above. In short, based on config files you can't.

If you want to know the resulting global settings currently used by the system, use emerge --info. This should give you a massive amount of details. Usually CFLAGS are not very often overridden for a single package,so you can consider that output definitive.

If you want to know the USE flags of a specific package that is installed, you could use equery u <package>, provided the gentoolkit package is installed.