[PATCH] Portability fix for Solaris 10/x86
* getdomainname unavailable there. * needs -lsocket for linkage. * needs __EXTENSIONS__ at the beginning of convert-objects.c [JC: I've done this slightly differently from what Patrick originally sent to the list and dropped the bit that deals with installations that has curl header and library at non-default location. I am resisting the slipperly slope called autoconf.] Signed-off-by: Junio C Hamano <junkio@cox.net>
Patrick Mauritz committed
Sep 6, 2005 at 01:24 UTC
f0ebff0dfebc667e5edf6f67d190fd960513ab66
3 files changed
+19
-3
Makefile
+16
-2
@@ -13,8 +13,14 @@
13
# a bundled SHA1 routine optimized for PowerPC.
14
#
15
# Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin).
16
+#
17
# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
17
-
18
+#
19
+# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
20
+# Patrick Mauritz).
21
+#
22
+# Define NO_GETDOMAINNAME if your library lack it (SunOS, Patrick Mauritz).
23
+#
24
# Define COLLISION_CHECK below if you believe that SHA1's
25
# 1461501637330902918203684832716283019655932542976 hashes do not give you
26
# sufficient guarantee that no collisions between objects will ever happen.
@@ -37,7 +43,7 @@
43
GIT_VERSION = 0.99.6
44
45
CFLAGS = -g -O2 -Wall
40
-ALL_CFLAGS = $(CFLAGS) $(DEFINES)
46
+ALL_CFLAGS = $(CFLAGS) $(PLATFORM_DEFINES) $(DEFINES)
47
48
prefix = $(HOME)
49
bindir = $(prefix)/bin
@@ -131,6 +137,10 @@ ifeq ($(shell uname -s),Darwin)
137
NEEDS_SSL_WITH_CRYPTO = YesPlease
138
NEEDS_LIBICONV = YesPlease
139
endif
140
+ifeq ($(shell uname -s),SunOS)
141
+ NEEDS_SOCKET = YesPlease
142
+ PLATFORM_DEFINES += -DNO_GETDOMAINNAME=1
143
+endif
144
145
ifndef NO_OPENSSL
146
LIB_OBJS += epoch.o
@@ -162,6 +172,10 @@ else
172
LIBS += $(LIB_4_CRYPTO)
173
endif
174
endif
175
+ifdef NEEDS_SOCKET
176
+ LIBS += -lsocket
177
+ SIMPLE_LIB += -lsocket
178
+endif
179
180
DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
181
convert-objects.c
+1
@@ -1,4 +1,5 @@
1
#define _XOPEN_SOURCE /* glibc2 needs this */
2
+#define __EXTENSIONS__ /* solaris needs this */
3
#include <time.h>
4
#include <ctype.h>
5
#include "cache.h"
ident.c
+2
-1
@@ -36,12 +36,13 @@ 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
40
if (!strchr(real_email+len, '.')) {
41
len = strlen(real_email);
42
real_email[len++] = '.';
43
getdomainname(real_email+len, sizeof(real_email)-len);
44
}
44
-
45
+#endif
46
/* And set the default date */
47
datestamp(real_date, sizeof(real_date));
48
return 0;