When building bitcoin with upnp completely disabled in the build via setting this in makefile.unix...
USE_UPNP:=
...then I get this build warning:
obj/db.o: In function `CWalletDB::LoadWallet()':
bitcoin/db.cpp:811: undefined reference to `fUseUPnP'
obj/db.o: In function `Unserialize':
bitcoin/serialize.h:136: undefined reference to `fUseUPnP'
Based on how fHaveUPnP is used in other files, it looks like db.cpp needs to wrap its fHaveUPnP usages with
#if USE_UPNP
...
#endif