Configuration and compilation settings used for Ubuntu packages
Solution 1:
Ubuntu binaries may contain patches as well.
Best thing to do is to download the source with apt-source
You may need to Enable the source repositories
apt-source will download and unpackage the source code.
apt-source foo
You can then examine the source code, any patches, and the configuration options.
The compile options are in debian/rules
Note: there is sometimes some variation in some of the packages.
See also
http://www.cyberciti.biz/faq/rebuilding-ubuntu-debian-linux-binary-package/
The packaging guide is invaluable when learning how the source code is packaged
https://wiki.ubuntu.com/PackagingGuide/Complete