Jason Riedy suggests that we should be able to use getdomainname
if we properly specify which libraries to link.
Signed-off-by: Junio C Hamano <redacted>
---
I've tried this on an ancient Solaris machine I happened to
have access at work and it seems to link OK. Patrick, could
you try this and see if it works OK for you?
Makefile | 6 +++++-
ident.c | 2 --
2 files changed, 5 insertions(+), 3 deletions(-)
2b6a27b6157c6ee472d654dbcaf380aec00d6444
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -148,7 +148,7 @@ ifeq ($(shell uname -s),Darwin)
endif
ifeq ($(shell uname -s),SunOS)
NEEDS_SOCKET = YesPlease
- PLATFORM_DEFINES += -DNO_GETDOMAINNAME=1
+ NEEDS_NSL = YesPlease
endif
ifndef SHELL_PATH
@@ -195,6 +195,10 @@ ifdef NEEDS_SOCKET
LIBS += -lsocket
SIMPLE_LIB += -lsocket
endif
+ifdef NEEDS_NSL
+ LIBS += -lnsl
+ SIMPLE_LIB += -lnsl
+endif
DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
diff --git a/ident.c b/ident.c
--- a/ident.c
+++ b/ident.c
@@ -36,13 +36,11 @@ int setup_ident(void)
memcpy(real_email, pw->pw_name, len);
real_email[len++] = '@';
gethostname(real_email + len, sizeof(real_email) - len);
-#ifndef NO_GETDOMAINNAME
if (!strchr(real_email+len, '.')) {
len = strlen(real_email);
real_email[len++] = '.';
getdomainname(real_email+len, sizeof(real_email)-len);
}
-#endif
/* And set the default date */
datestamp(real_date, sizeof(real_date));
return 0;