Can I distribute CiviCRM as part of a GPL-licensed piece of software? How does that work?
CiviCRM 1:
Yes, so long as CiviCRM is a separate and independent program from the GPL-licensed software. You cannot combine code licensed under both licenses into a single program and then redistribute that combination because the AGPL and the GPL 2 are incompatible. CiviCRM is designed to be a stand-alone application that can communicate with other applications via a defined and published application programming interface (API). If you do not make modifications to CiviCRM files, but instead distribute it along side another application that utilizes the CiviCRM functionality only through its API, CiviCRM will remain a separate and independent program from the other application. This means that, although you must of course still comply with the AGPL with respect to CiviCRM, your distribution of the other separate and independent program is not governed by the AGPL.
CiviCRM 2:
See the above for distributing as part of anything strictly licensed under GPL 2.
If the GPL code in question is licensed under GPL 3 or 'GPL 2 or later', you can combine the works, as GNU AGPL 3 (the license for the CiviCRM 2 code) is compatible with GPL 3. Note that the resulting work must be licensed under GNU AGPL 3 (licensing it under GPL 3 is not sufficient).