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

Re: [PATCH] HP-UX does not have select.h

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 18, 2007, 05:29 UTC
Message-ID
<7vbq8o370k.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20071217232259.0b41a3bf@pc09.procura.nl>
"H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
Show 13 quoted lines
> On Mon, 17 Dec 2007 13:00:22 -0800, Junio C Hamano <gitster@pobox.com> wrote:
>
>> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
>> 
>> > HP-UX does not have select.h, but it offers all select () functionality.
>> > The defines are in <sys/types.h> and <X11/fd.h>
>> 
>> Will apply the patch as-is for now, only because I do not want major
>> surgery during rc period, but I think is can be improved.
> ...
>> Besides, isn't _HPUX_SOURCE a feature-test macro?  Feature test macros
>
> That is defined in GNU gcc. I did not pass it with -D...
Actually I changed my mind.  I won't be applying this as is.

For the selective inclusion of <sys/select.h>, I would prefer it see it done like the attached.

The main point is to limit the "platform" dependency to configure and Makefile, and keep #ifdef in the actual header files expressed in more generic terms (e.g. "do we need to (and can we) include sys/select.h here?").

I am fuzzy about the uname_S part, so I won't be applying the attached patch either; the attached is for demonstration purposes only.

diff --git a/Makefile b/Makefile
index 617e5f5..f9f724a 100644
--- a/Makefile
+++ b/Makefile
@@ -100,6 +100,9 @@ all::
 #
 # Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
 #
+# Define NO_SYS_SELECT_H if your C library header files do not have <sys/select.h>
+# but you do have select(2) (pre POSIX.1-2001 systems, e.g. HP-UX before 11.23).
+#
 # Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
 # that tells runtime paths to dynamic libraries;
 # "-Wl,-rpath=/path/lib" is used instead.
@@ -504,6 +507,9 @@ endif
 ifneq (,$(findstring arm,$(uname_M)))
 	ARM_SHA1 = YesPlease
 endif
+ifeq ($(uname_S),HP-UX)
+	NO_SYS_SELECT_H = YesPlease
+endif
 
 -include config.mak.autogen
 -include config.mak
@@ -676,6 +682,10 @@ ifdef NO_DEFLATE_BOUND
 	BASIC_CFLAGS += -DNO_DEFLATE_BOUND
 endif
 
+ifdef NO_SYS_SELECT_H
+	BASIC_CFLAGS += -DNO_SYS_SELECT_H
+endif
+
 ifdef PPC_SHA1
 	SHA1_HEADER = "ppc/sha1.h"
 	LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
diff --git a/config.mak.in b/config.mak.in
index 15fb26c..e8890e0 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -44,3 +44,4 @@ NO_MKDTEMP=@NO_MKDTEMP@
 NO_ICONV=@NO_ICONV@
 OLD_ICONV=@OLD_ICONV@
 NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
+NO_SYS_SELECT_H=@NO_SYS_SELECT_H@
diff --git a/configure.ac b/configure.ac
index 6f641e3..3bfd0b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -256,6 +256,8 @@ AC_COMPILE_IFELSE(OLDICONVTEST_SRC,
 	OLD_ICONV=UnfortunatelyYes])
 AC_SUBST(OLD_ICONV)
 
+AC_CHECK_HEADER([sys/select.h], [], [NO_SYS_SELECT_H=YesPlease])
+AC_SUBST(NO_SYS_SELECT_H)
 
 ## Checks for typedefs, structures, and compiler characteristics.
 AC_MSG_NOTICE([CHECKS for typedefs, structures, and compiler characteristics])
diff --git a/git-compat-util.h b/git-compat-util.h
index 79eb10e..ec3585e 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -68,7 +68,9 @@
 #include <sys/poll.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+#ifndef NO_SYS_SELECT_H
 #include <sys/select.h>
+#endif
 #include <assert.h>
 #include <regex.h>
 #include <netinet/in.h>
Previous: H.Merijn BrandNext: H.Merijn Brand
Message 4 of 20 in “HP-UX does not have select.h”
  1. HP-UX does not have select.hH.Merijn Brand, Dec 17, 2007
  2. Junio C HamanoDec 17, 2007
  3. H.Merijn BrandDec 17, 2007
  4. Junio C HamanoDec 18, 2007
  5. H.Merijn BrandDec 18, 2007
  6. Johannes SixtDec 18, 2007
  7. Johannes SchindelinDec 18, 2007
  8. Johannes SixtDec 18, 2007
  9. Johannes SchindelinDec 18, 2007
  10. Johannes SixtDec 18, 2007
  11. Andreas EricssonDec 18, 2007
  12. Junio C HamanoDec 18, 2007
  13. H.Merijn BrandDec 18, 2007
  14. Junio C HamanoDec 19, 2007
  15. H.Merijn BrandDec 19, 2007
  16. Junio C HamanoDec 19, 2007
  17. H.Merijn BrandDec 20, 2007
  18. Junio C HamanoDec 20, 2007
  19. Jan HudecDec 23, 2007
  20. H.Merijn BrandDec 23, 2007

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.