git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/3] Support building on systems without poll(2)

From
JCJonathan Callen <abcd@gentoo.org>
Date
May 27, 2010, 08:19 UTC
Message-ID
<1274948384-167-2-git-send-email-abcd@gentoo.org>
In-Reply-To
<1274948384-167-1-git-send-email-abcd@gentoo.org>

Some systems do not have sys/poll.h or poll(2). Don't build git-daemon, git-upload-archive, or git-upload-pack on such systems.

Signed-off-by: Jonathan Callen <abcd@gentoo.org>
---
 Makefile          |   21 ++++++++++++++++-----
 builtin.h         |    2 ++
 git-compat-util.h |    2 ++
 git.c             |    2 ++
 4 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 07cab8f..4b36534 100644
--- a/Makefile
+++ b/Makefile
@@ -62,6 +62,8 @@ all::
 #
 # Define NO_MKSTEMPS if you don't have mkstemps in the C library.
 #
+# Define NO_POLL if you don't have poll in the C library, or it does not work.
+#
 # Define NO_LIBGEN_H if you don't have libgen.h.
 #
 # Define NEEDS_LIBGEN if your libgen needs -lgen when linking
@@ -386,7 +388,6 @@ PROGRAM_OBJS += fast-import.o
 PROGRAM_OBJS += imap-send.o
 PROGRAM_OBJS += shell.o
 PROGRAM_OBJS += show-index.o
-PROGRAM_OBJS += upload-pack.o
 PROGRAM_OBJS += http-backend.o
 
 PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
@@ -434,9 +435,7 @@ OTHER_PROGRAMS = git$X
 
 # what test wrappers are needed and 'install' will install, in bindir
 BINDIR_PROGRAMS_NEED_X += git
-BINDIR_PROGRAMS_NEED_X += git-upload-pack
 BINDIR_PROGRAMS_NEED_X += git-receive-pack
-BINDIR_PROGRAMS_NEED_X += git-upload-archive
 BINDIR_PROGRAMS_NEED_X += git-shell
 
 BINDIR_PROGRAMS_NO_X += git-cvsserver
@@ -722,7 +721,6 @@ BUILTIN_OBJS += builtin/unpack-objects.o
 BUILTIN_OBJS += builtin/update-index.o
 BUILTIN_OBJS += builtin/update-ref.o
 BUILTIN_OBJS += builtin/update-server-info.o
-BUILTIN_OBJS += builtin/upload-archive.o
 BUILTIN_OBJS += builtin/var.o
 BUILTIN_OBJS += builtin/verify-pack.o
 BUILTIN_OBJS += builtin/verify-tag.o
@@ -1162,8 +1160,17 @@ ifdef ZLIB_PATH
 endif
 EXTLIBS += -lz
 
+ifndef NO_POLL
+	BUILTIN_OBJS += builtin/upload-archive.o
+	PROGRAM_OBJS += upload-pack.o
+	BINDIR_PROGRAMS_NEED_X += git-upload-archive
+	BINDIR_PROGRAMS_NEED_X += git-upload-pack
+endif
+
 ifndef NO_POSIX_ONLY_PROGRAMS
-	PROGRAM_OBJS += daemon.o
+	ifndef NO_POLL
+		PROGRAM_OBJS += daemon.o
+	endif
 endif
 ifndef NO_OPENSSL
 	OPENSSL_LIBSSL = -lssl
@@ -1322,6 +1329,10 @@ ifdef OLD_ICONV
 	BASIC_CFLAGS += -DOLD_ICONV
 endif
 
+ifdef NO_POLL
+	BASIC_CFLAGS += -DNO_POLL
+endif
+
 ifdef NO_DEFLATE_BOUND
 	BASIC_CFLAGS += -DNO_DEFLATE_BOUND
 endif
diff --git a/builtin.h b/builtin.h
index 5c887ef..165a748 100644
--- a/builtin.h
+++ b/builtin.h
@@ -127,7 +127,9 @@ extern int cmd_unpack_objects(int argc, const char **argv, const char *prefix);
 extern int cmd_update_index(int argc, const char **argv, const char *prefix);
 extern int cmd_update_ref(int argc, const char **argv, const char *prefix);
 extern int cmd_update_server_info(int argc, const char **argv, const char *prefix);
+#ifdef NO_POLL
 extern int cmd_upload_archive(int argc, const char **argv, const char *prefix);
+#endif
 extern int cmd_upload_tar(int argc, const char **argv, const char *prefix);
 extern int cmd_var(int argc, const char **argv, const char *prefix);
 extern int cmd_verify_tag(int argc, const char **argv, const char *prefix);
diff --git a/git-compat-util.h b/git-compat-util.h
index edf352d..c5188e5 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -94,7 +94,9 @@
 #include <utime.h>
 #ifndef __MINGW32__
 #include <sys/wait.h>
+#ifndef NO_POLL
 #include <sys/poll.h>
+#endif
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <termios.h>
diff --git a/git.c b/git.c
index 99f0363..8c081db 100644
--- a/git.c
+++ b/git.c
@@ -390,7 +390,9 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "update-index", cmd_update_index, RUN_SETUP },
 		{ "update-ref", cmd_update_ref, RUN_SETUP },
 		{ "update-server-info", cmd_update_server_info, RUN_SETUP },
+#ifndef NO_POLL
 		{ "upload-archive", cmd_upload_archive },
+#endif
 		{ "var", cmd_var },
 		{ "verify-tag", cmd_verify_tag, RUN_SETUP },
 		{ "version", cmd_version },
-- 
1.7.1
Previous: Jonathan CallenNext: Sverre Rabbelier
Message 2 of 39 in “Interix support”
  1. 0/3 Interix supportJonathan Callen, May 27, 2010
  2. 1/3 Support building on systems without poll(2)Jonathan Callen, May 27, 2010
  3. Sverre RabbelierMay 27, 2010
  4. Jeff KingMay 27, 2010
  5. Michael J GruberMay 27, 2010
  6. Jonathan CallenMay 27, 2010
  7. compat: Add another rudimentary poll() emulationJonathan Nieder, May 27, 2010
  8. Erik Faye-LundMay 27, 2010
  9. Marko KreenMay 27, 2010
  10. Erik Faye-LundMay 27, 2010
  11. Marko KreenMay 27, 2010
  12. Erik Faye-LundMay 27, 2010
  13. Albert DvornikMay 27, 2010
  14. Paolo BonziniMay 30, 2010
  15. Erik Faye-LundMay 27, 2010
  16. Marko KreenMay 27, 2010
  17. Erik Faye-LundMay 27, 2010
  18. Marko KreenMay 27, 2010
  19. Erik Faye-LundMay 27, 2010
  20. Marko KreenMay 27, 2010
  21. Erik Faye-LundMay 27, 2010
  22. Marko KreenMay 27, 2010
  23. Erik Faye-LundMay 27, 2010
  24. Peter KjellerstedtMay 27, 2010
  25. Albert DvornikMay 27, 2010
  26. Albert DvornikMay 27, 2010
  27. compat: Add another rudimentary poll() emulationJonathan Nieder, May 30, 2010
  28. Johannes SixtMay 30, 2010
  29. Jonathan NiederMay 30, 2010
  30. Joshua JuranMay 30, 2010
  31. Mac OS 9 (Lamp) portJonathan Nieder, May 31, 2010
  32. Joshua JuranMay 31, 2010
  33. Jonathan NiederMay 31, 2010
  34. Albert DvornikMay 31, 2010
  35. Jonathan NiederMay 31, 2010
  36. Albert DvornikMay 31, 2010
  37. 2/3 Support building without inttypes.hJonathan Callen, May 27, 2010
  38. 3/3 Add Interix supportJonathan Callen, May 27, 2010
  39. Jakub NarebskiMay 28, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.