The problem may be that Emacs is linked with a wimpier version of gethostbyname than the rest of the programs on the machine. This is often manifested as a message on startup of `X server not responding. Check your DISPLAY environment variable.' or a message of `Unknown host' from open-network-stream.
On a Sun, this may be because Emacs had to be linked with the static C library. The version of gethostbyname in the static C library may only look in /etc/hosts and the NIS (YP) maps, while the version in the dynamic C library may be smart enough to check DNS in addition to or instead of NIS. On a Motorola Delta running System V R3.6, the version of gethosbyname in the standard library works, but the one that works with NIS doesn't (the one you get with -linet). Other operating systems have similar problems.
Try these options:
#define LIBS_SYSTEM -lresolv