Makefile: unix sockets may not available on some platforms
Introduce a configuration option NO_UNIX_SOCKETS to exclude code that depends on Unix sockets and use it in MSVC and MinGW builds. Notice that unix-socket.h was missing from LIB_H before; fix that, too. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Sixt committed
Dec 12, 2011 at 22:12 UTC
6320358e31d42f25fa4ac5eb4e72574630de1692
2 files changed
+16
-3
Makefile
+11
-3
@@ -143,6 +143,8 @@ all::
143
#
144
# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
145
#
146
+# Define NO_UNIX_SOCKETS if your system does not offer unix sockets.
147
+#
148
# Define NO_SOCKADDR_STORAGE if your platform does not have struct
149
# sockaddr_storage.
150
#
@@ -427,8 +429,6 @@ PROGRAM_OBJS += show-index.o
429
PROGRAM_OBJS += upload-pack.o
430
PROGRAM_OBJS += http-backend.o
431
PROGRAM_OBJS += sh-i18n--envsubst.o
430
-PROGRAM_OBJS += credential-cache.o
431
-PROGRAM_OBJS += credential-cache--daemon.o
432
433
PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
434
@@ -701,7 +701,6 @@ LIB_OBJS += transport-helper.o
701
LIB_OBJS += tree-diff.o
702
LIB_OBJS += tree.o
703
LIB_OBJS += tree-walk.o
704
-LIB_OBJS += unix-socket.o
704
LIB_OBJS += unpack-trees.o
705
LIB_OBJS += url.o
706
LIB_OBJS += usage.o
@@ -1104,6 +1103,7 @@ ifeq ($(uname_S),Windows)
1103
NO_SYS_POLL_H = YesPlease
1104
NO_SYMLINK_HEAD = YesPlease
1105
NO_IPV6 = YesPlease
1106
+ NO_UNIX_SOCKETS = YesPlease
1107
NO_SETENV = YesPlease
1108
NO_UNSETENV = YesPlease
1109
NO_STRCASESTR = YesPlease
@@ -1197,6 +1197,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
1197
NO_LIBGEN_H = YesPlease
1198
NO_SYS_POLL_H = YesPlease
1199
NO_SYMLINK_HEAD = YesPlease
1200
+ NO_UNIX_SOCKETS = YesPlease
1201
NO_SETENV = YesPlease
1202
NO_UNSETENV = YesPlease
1203
NO_STRCASESTR = YesPlease
@@ -1574,6 +1575,12 @@ ifdef NO_INET_PTON
1575
LIB_OBJS += compat/inet_pton.o
1576
BASIC_CFLAGS += -DNO_INET_PTON
1577
endif
1578
+ifndef NO_UNIX_SOCKETS
1579
+ LIB_OBJS += unix-socket.o
1580
+ LIB_H += unix-socket.h
1581
+ PROGRAM_OBJS += credential-cache.o
1582
+ PROGRAM_OBJS += credential-cache--daemon.o
1583
+endif
1584
1585
ifdef NO_ICONV
1586
BASIC_CFLAGS += -DNO_ICONV
@@ -2209,6 +2216,7 @@ ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
2216
@echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@
2217
endif
2218
@echo GETTEXT_POISON=\''$(subst ','\'',$(subst ','\'',$(GETTEXT_POISON)))'\' >>$@
2219
+ @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@
2220
2221
### Detect Tck/Tk interpreter path changes
2222
ifndef NO_TCLTK
t/t0301-credential-cache.sh
+5
@@ -4,6 +4,11 @@ test_description='credential-cache tests'
4
. ./test-lib.sh
5
. "$TEST_DIRECTORY"/lib-credential.sh
6
7
+test -z "$NO_UNIX_SOCKETS" || {
8
+ skip_all='skipping credential-cache tests, unix sockets not available'
9
+ test_done
10
+}
11
+
12
# don't leave a stale daemon running
13
trap 'code=$?; git credential-cache exit; (exit $code); die' EXIT
14