[PATCH] getdomainname should be usable on SunOS with -lnsl
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 <junkio@cox.net>
Junio C Hamano committed
Sep 11, 2005 at 22:25 UTC
5a90d4ac1ab4d7700595e415e3a2062ecb378523
3 files changed
+6
-4
Makefile
+6
-1
@@ -151,7 +151,8 @@ ifeq ($(shell uname -s),Darwin)
151
endif
152
ifeq ($(shell uname -s),SunOS)
153
NEEDS_SOCKET = YesPlease
154
- PLATFORM_DEFINES += -DNO_GETDOMAINNAME=1
154
+ NEEDS_NSL = YesPlease
155
+ PLATFORM_DEFINES += -D__EXTENSIONS__
156
endif
157
158
ifndef SHELL_PATH
@@ -198,6 +199,10 @@ ifdef NEEDS_SOCKET
199
LIBS += -lsocket
200
SIMPLE_LIB += -lsocket
201
endif
202
+ifdef NEEDS_NSL
203
+ LIBS += -lnsl
204
+ SIMPLE_LIB += -lnsl
205
+endif
206
207
DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
208
convert-objects.c
-1
@@ -1,5 +1,4 @@
1
#define _XOPEN_SOURCE /* glibc2 needs this */
2
-#define __EXTENSIONS__ /* solaris needs this */
2
#include <time.h>
3
#include <ctype.h>
4
#include "cache.h"
ident.c
-2
@@ -36,13 +36,11 @@ int setup_ident(void)
36
memcpy(real_email, pw->pw_name, len);
37
real_email[len++] = '@';
38
gethostname(real_email + len, sizeof(real_email) - len);
39
-#ifndef NO_GETDOMAINNAME
39
if (!strchr(real_email+len, '.')) {
40
len = strlen(real_email);
41
real_email[len++] = '.';
42
getdomainname(real_email+len, sizeof(real_email)-len);
43
}
45
-#endif
44
/* And set the default date */
45
datestamp(real_date, sizeof(real_date));
46
return 0;