-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathgit.patch
More file actions
134 lines (130 loc) · 3.9 KB
/
Copy pathgit.patch
File metadata and controls
134 lines (130 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Written and placed in public domain by Jeffrey Walton.
# This patch fixes some issues with Git.
--- configure.ac
+++ configure.ac
@@ -677,39 +677,57 @@
GIT_CONF_SUBST([NO_DEFLATE_BOUND])
#
+# The next few tests will define NEEDS_RESOLV, NEEDS_SOCKET or
+# NEEDS_NSL if linking with libresolv, libsocket and libnsl
+# provides some of the functions we would normally get from libc.
+NEEDS_RESOLV=
+NEEDS_SOCKET=
+NEEDS_NSL=
+
+#
# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
# Patrick Mauritz).
-AC_CHECK_LIB([c], [socket],
-[NEEDS_SOCKET=],
-[NEEDS_SOCKET=YesPlease])
-GIT_CONF_SUBST([NEEDS_SOCKET])
-test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
+AC_CHECK_FUNC([socket],
+ [],
+ [AC_SEARCH_LIBS([socket], [c],
+ [NEEDS_SOCKET=],
+ [NEEDS_SOCKET=YesPlease])
+])
#
-# The next few tests will define NEEDS_RESOLV if linking with
-# libresolv provides some of the functions we would normally get
-# from libc.
-NEEDS_RESOLV=
-#
-# Define NO_INET_NTOP if linking with -lresolv is not enough.
-# Solaris 2.7 in particular hos inet_ntop in -lresolv.
+# Define NO_INET_NTOP if linking with -lresolv, -lsocket and -lnsl
+# is not enough. Solaris 11 provides inet_ntop in -lsocket -lnsl.
+# Solaris 2.7 provides inet_ntop in -lresolv.
NO_INET_NTOP=
AC_CHECK_FUNC([inet_ntop],
[],
- [AC_CHECK_LIB([resolv], [inet_ntop],
- [NEEDS_RESOLV=YesPlease],
- [NO_INET_NTOP=YesPlease])
+ [AC_SEARCH_LIBS([inet_ntop], [socket nsl],
+ [NEEDS_SOCKET=YesPlease; NEEDS_NSL=YesPlease],
+ [AC_CHECK_FUNC([inet_ntop],
+ [],
+ [AC_SEARCH_LIBS([inet_ntop], [resolv],
+ [NEEDS_RESOLV=YesPlease],
+ [NO_INET_PTON=YesPlease])
+ ])
+ ])
])
GIT_CONF_SUBST([NO_INET_NTOP])
#
-# Define NO_INET_PTON if linking with -lresolv is not enough.
-# Solaris 2.7 in particular hos inet_pton in -lresolv.
+# Define NO_INET_PTON if linking with -lresolv, -lsocket and -lnsl
+# is not enough. Solaris 11 provides inet_pton in -lsocket -lnsl.
+# Solaris 2.7 provides inet_pton in -lresolv.
NO_INET_PTON=
AC_CHECK_FUNC([inet_pton],
[],
- [AC_CHECK_LIB([resolv], [inet_pton],
- [NEEDS_RESOLV=YesPlease],
- [NO_INET_PTON=YesPlease])
+ [AC_SEARCH_LIBS([inet_pton], [socket nsl],
+ [NEEDS_SOCKET=YesPlease; NEEDS_NSL=YesPlease],
+ [AC_CHECK_FUNC([inet_pton],
+ [],
+ [AC_SEARCH_LIBS([inet_pton], [resolv],
+ [NEEDS_RESOLV=YesPlease],
+ [NO_INET_PTON=YesPlease])
+ ])
+ ])
])
GIT_CONF_SUBST([NO_INET_PTON])
#
@@ -718,19 +736,25 @@
NO_HSTRERROR=
AC_CHECK_FUNC([hstrerror],
[],
- [AC_CHECK_LIB([resolv], [hstrerror],
- [NEEDS_RESOLV=YesPlease],
- [NO_HSTRERROR=YesPlease])
+ [AC_SEARCH_LIBS([hstrerror], [resolv],
+ [NEEDS_RESOLV=YesPlease],
+ [NO_HSTRERROR=YesPlease])
])
GIT_CONF_SUBST([NO_HSTRERROR])
dnl This must go after all the possible places for its initialization,
dnl in the AC_CHECK_FUNC invocations above.
GIT_CONF_SUBST([NEEDS_RESOLV])
+GIT_CONF_SUBST([NEEDS_SOCKET])
+GIT_CONF_SUBST([NEEDS_NSL])
+
#
-# If any of the above tests determined that -lresolv is needed at
-# build-time, also set it here for remaining configure-time checks.
+# If any of the above tests determined that -lresolv, -lsocket or -lnsl
+# are needed at build-time, also set it here for remaining configure-time
+# checks. The Sun man pages list library order as -lresolv -lsocket -lnsl.
test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
+test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
+test -n "$NEEDS_NSL" && LIBS="$LIBS -lnsl"
AC_CHECK_LIB([c], [basename],
[NEEDS_LIBGEN=],
--- Makefile
+++ Makefile
@@ -1504,15 +1504,15 @@
EXTLIBS += -lintl
endif
endif
+ifdef NEEDS_RESOLV
+ EXTLIBS += -lresolv
+endif
ifdef NEEDS_SOCKET
EXTLIBS += -lsocket
endif
ifdef NEEDS_NSL
EXTLIBS += -lnsl
endif
-ifdef NEEDS_RESOLV
- EXTLIBS += -lresolv
-endif
ifdef NO_D_TYPE_IN_DIRENT
BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
endif