some systems don't have (and need) sys/select.h
PATCH 1/1 some systems don't have (and need) sys/select.h
The select stuff is already in sys/time.h on on some systems like HP-UX thus we should not include sys/select.h in that case.
---
This patch replaces my previously sent patch
"HP-UX traditionally has no sys/select.h".
Makefile | 5 +++++ git-compat-util.h | 2 ++ 2 files changed, 7 insertions(+), 0 deletions(-)
Makefile +5 -0
@@ -42,6 +42,8 @@ all:: # # Define NO_MKDTEMP if you don't have mkdtemp in the C library. # +# Define NO_SYS_SELECT_H if you don't have sys/select.h. +# # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link. # Enable it on Windows. By default, symrefs are still used. #
@@ -635,6 +637,9 @@ ifdef NO_UNSETENV COMPAT_CFLAGS += -DNO_UNSETENV COMPAT_OBJS += compat/unsetenv.o endif +ifdef NO_SYS_SELECT_H + BASIC_CFLAGS += -DNO_SYS_SELECT_H +endif ifdef NO_MMAP COMPAT_CFLAGS += -DNO_MMAP COMPAT_OBJS += compat/mmap.o
git-compat-util.h +2 -0
@@ -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>
Signature · 1 line
1.5.2.4
PATCH 1/1 autoconf: Add test for sys/select.h header file
Some systems like HP-UX don't have sys/select.h; the select stuff is already present in some other headef file (e.g. sys/time.h for HP-UX).
Companion to
"some systems don't have (and need) sys/select.h"
---
It could be alternately just squashed together with
"some systems don't have (and need) sys/select.h" by Robert Schiele.
Robert, could you please check this patch on HP-UX? It does work correctly on Linux (which has sys/select.h).
config.mak.in | 1 + configure.ac | 6 ++++++ 2 files changed, 7 insertions(+), 0 deletions(-)
config.mak.in +1 -0
@@ -30,6 +30,7 @@ NO_CURL=@NO_CURL@ NO_EXPAT=@NO_EXPAT@ NEEDS_LIBICONV=@NEEDS_LIBICONV@ NEEDS_SOCKET=@NEEDS_SOCKET@ +NO_SYS_SELECT_H=@NO_SYS_SELECT_H@ NO_D_INO_IN_DIRENT=@NO_D_INO_IN_DIRENT@ NO_D_TYPE_IN_DIRENT=@NO_D_TYPE_IN_DIRENT@ NO_SOCKADDR_STORAGE=@NO_SOCKADDR_STORAGE@
configure.ac +6 -0
@@ -235,6 +235,12 @@ test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket" ## Checks for header files. AC_MSG_NOTICE([CHECKS for header files]) # +# Define NO_SYS_SELECT_H if you don't have sys/select.h. +AC_CHECK_HEADER([sys/select.h], +[NO_SYS_SELECT_H=], +[NO_SYS_SELECT_H=UnfortunatelyYes]) +AC_SUBST(NO_SYS_SELECT_H) +# # Define OLD_ICONV if your library has an old iconv(), where the second # (input buffer pointer) parameter is declared with type (const char **). AC_DEFUN([OLDICONVTEST_SRC], [[
Signature · 1 line
1.5.3.7
Re: [PATCH] autoconf: Add test for sys/select.h header file
Quoted 7 lines · Jakub Narebski
Some systems like HP-UX don't have
sys/select.h; the select stuff is already present in some other headef file (e.g.sys/time.hfor HP-UX).Companion to
"some systems don't have (and need)sys/select.h"
Quoted 7 lines
Signed-off-by Jakub Narebski <[email protected]>---
It could be alternately just squashed together with
"some systems don't have (and need)sys/select.h" by Robert Schiele.Robert, could you please check this patch on HP-UX? It does work correctly on Linux (which has
sys/select.h).
The issue is not really about "do we have <sys/select.h>?" but is about "do we need to include <sys/select.h> in order to obtain declaration of select(2)?" so this is covering only a half of the issue. But I guess we will find out if the system does not offer select(2) whether <sys/select.h> is included or not, so this is not too bad.
Will apply. I do not think it would have problems but even if it does it is small and easy to revert before the final.
Thanks.
Re: [PATCH] autoconf: Add test for sys/select.h header file
Quoted 3 lines · Junio C Hamano
The issue is not really about "do we have <
sys/select.h>?" but is about "do we need to include <sys/select.h> in order to obtain declaration of select(2)?" so this is covering only a
This is true. Actually HP-UX 11.23 for instance has sys/select.h but this is not intended to be included to get the select call but this is intended to be included by kernel drivers that implement the interface the kernel needs to _provide_ the select call. In that case the test determines that sys/select.h exists but it does not notice that it is not the header to include. It does not hurt though since including sys/select.h outside of a kernel driver is a no-op and we include sys/time.h which is really needed anyway.
Quoted 6 lines
half of the issue. But I guess we will find out if the system does not offer select(2) whether <
sys/select.h> is included or not, so this is not too bad.Will apply. I do not think it would have problems but even if it does it is small and easy to revert before the final.
At least on the systems I know it does not hurt even when it does not always exactly what it is intended to do.
Robert
Signature · 4 lines
Robert Schiele Dipl.-Wirtsch.informatiker mailto:[email protected] "Quidquid latine dictum sit, altum sonatur."
Re: [PATCH] autoconf: Add test for sys/select.h header file
In reply to Jakub NarebskiHi,
Quoted 5 lines · Jakub Narebski
configure.ac +0
-0
configure.ac test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket" · line 243
Quoted 9 lines
configure.ac +6
-0@@ -235,6 +235,12 @@ test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket" ## Checks for header files. AC_MSG_NOTICE([CHECKS for header files]) # +# Define NO_SYS_SELECT_H if you don't have sys/select.h. +AC_CHECK_HEADER([sys/select.h], +[NO_SYS_SELECT_H=], +[NO_SYS_SELECT_H=UnfortunatelyYes]) +AC_SUBST(NO_SYS_SELECT_H) +#
Just because I am curious: would that not define "NO_SYS_SELECT_H" in both cases? IOW would the "ifdef NO_SYS_SELECT_H" not be triggered all the time?
Thanks,
Dscho
Re: [PATCH] autoconf: Add test for sys/select.h header file
Quoted 14 lines · Johannes Schindelin
Hi,
Quoted 10 lines · Jakub Narebski
configure.ac +2
-0@@ -235,6 +235,12 @@ test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket" ## Checks for header files. AC_MSG_NOTICE([CHECKS for header files]) # +# Define NO_SYS_SELECT_H if you don't have sys/select.h. +AC_CHECK_HEADER([sys/select.h],
Quoted 8 lines
configure.ac test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket" · line 243
Quoted 4 lines
configure.ac +4
-0+[NO_SYS_SELECT_H=], +[NO_SYS_SELECT_H=UnfortunatelyYes]) +AC_SUBST(NO_SYS_SELECT_H) +#Just because I am curious: would that not define "
NO_SYS_SELECT_H" in both cases? IOW would the "ifdefNO_SYS_SELECT_H" not be triggered all the time?
No, in make the empty string is equal to not being defined.
Robert
Signature · 4 lines
Robert Schiele Dipl.-Wirtsch.informatiker mailto:[email protected] "Quidquid latine dictum sit, altum sonatur."
Quoted 4 lines · Robert Schiele
The select stuff is already in
sys/time.hon on some systems like HP-UX thus we should not includesys/select.hin that case.Signed-off-by Robert Schiele <[email protected]>
The patch looks good. I'd rather try to be a bit more helpful to people who want to port git to their system that is not HP-UX, though.
How about wording it like this?
Subject: pre-POSIX.1-2001 systems do not have <sys/select.h>
POSIX.1-2001 has declaration of select(2) in <sys/select.h>, but in previous version of SUS, it is declared in <sys/time.h>, which is already included in git-compat-util.h.
This introduces NO_SYS_SELECT_H macro in the Makefile to be set on older systems, to skip inclusion of <sys/select.h> that does not exist on them.
We could check _POSIX_VERSION with 200112L and do this automatically, but earlier it was reported that the approach does not work well on some vintage of HP-UX. Other systems may get _POSIX_VERSION itself wrong. At least for now, this manual configuration is safer.
Quoted 23 lines · Junio C Hamano
Quoted 4 lines · Robert Schiele
The select stuff is already in
sys/time.hon on some systems like HP-UX thus we should not includesys/select.hin that case.Signed-off-by Robert Schiele <[email protected]>The patch looks good. I'd rather try to be a bit more helpful to people who want to port git to their system that is not HP-UX, though.
How about wording it like this?
Subject: pre-POSIX.1-2001 systems do not have <
sys/select.h>POSIX.1-2001 has declaration of select(2) in <
sys/select.h>, but in previous version of SUS, it is declared in <sys/time.h>, which is already included ingit-compat-util.h.This introduces
NO_SYS_SELECT_Hmacro in theMakefileto be set on older systems, to skip inclusion of <sys/select.h> that does not exist on them.
Quoted 5 lines
We could check
_POSIX_VERSIONwith 200112L and do this automatically, but earlier it was reported that the approach does not work well on some vintage of HP-UX. Other systems may get_POSIX_VERSIONitself wrong. At least for now, this manual configuration is safer.
I have no strong opinion on the wording. Sounds reasonable to me.
Robert
Signature · 4 lines
Robert Schiele Dipl.-Wirtsch.informatiker mailto:[email protected] "Quidquid latine dictum sit, altum sonatur."
Hi,
Quoted 2 lines · Robert Schiele
The select stuff is already in
sys/time.hon on some systems like HP-UX thus we should not includesys/select.hin that case.
Thank you very much,
Dscho