So I am building a project with SDL2_image, and I noticed that it includes libpng, jpeg, libtiff, and other dependencies. If I want the code to be closed sourced, do I need to include the dependencies' licenses too, or would just the base license (SDL2_image in this case) be enough?
You will need a license for any library that you are including in your product. Including libraries that you didn't really want to include, but which are needed by another library that you intentially include. And you will have to agree to all the licenses simultaneously, which may be difficult.
If several libraries have conflicting licenses (that is you cannot possibly respect A's and B's license at the same time), then you must remove one of the libraries until no conflicts are left.
tl;dr: Check the license for each work you include or build on. Most free software licenses do require you to include their text.
do I need to include the dependencies' licenses too, or would just the base license (SDL2_image in this case) be enough?
That depends on the licenses, and on how you distribute the project. For example, the GPL V3 requires you to:
- "give all recipients a copy of this License along with the Program",and
- make the user interface (if any) to display "Appropriate Legal Notices", which must tell the user "how to view a copy of this License".
So, for the GPL V3 the answer would be "yes".
Similarly, the MIT license says that "this permission notice shall be included in all copies[...] of the Software".
On the other hand, if the license puts a work in the public domain, there is typically no requirement to include the license.