From 6ede720529b00115abe46b8ab524bf06c58047e2 Mon Sep 17 00:00:00 2001 From: David Michael Date: Fri, 14 Dec 2012 14:56:58 -0500 Subject: [PATCH 1/4] Support builds when sys/param.h is missing An option is added to the Makefile to skip the inclusion of sys/param.h. The only known platform with this condition thus far is the z/OS UNIX System Services environment. Signed-off-by: David Michael Signed-off-by: Junio C Hamano --- Makefile | 5 +++++ configure.ac | 6 ++++++ git-compat-util.h | 2 ++ 3 files changed, 13 insertions(+) diff --git a/Makefile b/Makefile index 6b73c14aa0..81c12db274 100644 --- a/Makefile +++ b/Makefile @@ -165,6 +165,8 @@ all:: # Define NO_POLL if you do not have or don't want to use poll(). # This also implies NO_SYS_POLL_H. # +# Define NO_SYS_PARAM_H if you don't have sys/param.h. +# # Define NO_PTHREADS if you do not have or do not want to use Pthreads. # # Define NO_PREAD if you have a problem with pread() system call (e.g. @@ -1739,6 +1741,9 @@ endif ifdef NO_SYS_POLL_H BASIC_CFLAGS += -DNO_SYS_POLL_H endif +ifdef NO_SYS_PARAM_H + BASIC_CFLAGS += -DNO_SYS_PARAM_H +endif ifdef NO_INTTYPES_H BASIC_CFLAGS += -DNO_INTTYPES_H endif diff --git a/configure.ac b/configure.ac index c85888c851..1393aa336c 100644 --- a/configure.ac +++ b/configure.ac @@ -699,6 +699,12 @@ AC_CHECK_HEADER([sys/poll.h], [NO_SYS_POLL_H=UnfortunatelyYes]) GIT_CONF_SUBST([NO_SYS_POLL_H]) # +# Define NO_SYS_PARAM_H if you don't have sys/param.h +AC_CHECK_HEADER([sys/param.h], +[NO_SYS_PARAM_H=], +[NO_SYS_PARAM_H=UnfortunatelyYes]) +GIT_CONF_SUBST([NO_SYS_PARAM_H]) +# # Define NO_INTTYPES_H if you don't have inttypes.h AC_CHECK_HEADER([inttypes.h], [NO_INTTYPES_H=], diff --git a/git-compat-util.h b/git-compat-util.h index 2e79b8a2f3..ace154901f 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -104,7 +104,9 @@ #endif #include #include +#ifndef NO_SYS_PARAM_H #include +#endif #include #include #include From 110d6985463886ecc53dbafe32e626704ec612cb Mon Sep 17 00:00:00 2001 From: David Michael Date: Fri, 14 Dec 2012 14:56:59 -0500 Subject: [PATCH 2/4] Detect when the passwd struct is missing pw_gecos NO_GECOS_IN_PWENT was documented with other Makefile variables but was only enforced by manually defining it to the C preprocessor. This adds support for detecting the condition with configure and defining the make variable. Signed-off-by: David Michael Signed-off-by: Junio C Hamano --- Makefile | 3 +++ configure.ac | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/Makefile b/Makefile index 81c12db274..e953951be8 100644 --- a/Makefile +++ b/Makefile @@ -1648,6 +1648,9 @@ endif ifdef NO_D_INO_IN_DIRENT BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT endif +ifdef NO_GECOS_IN_PWENT + BASIC_CFLAGS += -DNO_GECOS_IN_PWENT +endif ifdef NO_ST_BLOCKS_IN_STRUCT_STAT BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT endif diff --git a/configure.ac b/configure.ac index 1393aa336c..66d0c91ece 100644 --- a/configure.ac +++ b/configure.ac @@ -759,6 +759,14 @@ AC_CHECK_MEMBER(struct dirent.d_type, [#include ]) GIT_CONF_SUBST([NO_D_TYPE_IN_DIRENT]) # +# Define NO_GECOS_IN_PWENT if you don't have pw_gecos in struct passwd +# in the C library. +AC_CHECK_MEMBER(struct passwd.pw_gecos, +[NO_GECOS_IN_PWENT=], +[NO_GECOS_IN_PWENT=YesPlease], +[#include ]) +GIT_CONF_SUBST([NO_GECOS_IN_PWENT]) +# # Define NO_SOCKADDR_STORAGE if your platform does not have struct # sockaddr_storage. AC_CHECK_TYPE(struct sockaddr_storage, From b3e103dabeb01555f8766b74de73493f7a6ba048 Mon Sep 17 00:00:00 2001 From: David Michael Date: Fri, 14 Dec 2012 14:57:01 -0500 Subject: [PATCH 3/4] Generalize the inclusion of strings.h The header strings.h was formerly only included for HP NonStop (aka Tandem) to define strcasecmp, but another platform requiring this inclusion has been found. The build system will now include the file based on its presence determined by configure. Signed-off-by: David Michael Signed-off-by: Junio C Hamano --- Makefile | 7 +++++++ configure.ac | 6 ++++++ git-compat-util.h | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e953951be8..5cd1de02c7 100644 --- a/Makefile +++ b/Makefile @@ -74,6 +74,8 @@ all:: # Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks # d_type in struct dirent (Cygwin 1.5, fixed in Cygwin 1.7). # +# Define HAVE_STRINGS_H if you have strings.h and need it for strcasecmp. +# # Define NO_STRCASESTR if you don't have strcasestr. # # Define NO_MEMMEM if you don't have memmem. @@ -1350,6 +1352,7 @@ ifeq ($(uname_S),NONSTOP_KERNEL) # Added manually, see above. NEEDS_SSL_WITH_CURL = YesPlease HAVE_LIBCHARSET_H = YesPlease + HAVE_STRINGS_H = YesPlease NEEDS_LIBICONV = YesPlease NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease NO_SYS_SELECT_H = UnfortunatelyYes @@ -1883,6 +1886,10 @@ ifdef HAVE_LIBCHARSET_H EXTLIBS += $(CHARSET_LIB) endif +ifdef HAVE_STRINGS_H + BASIC_CFLAGS += -DHAVE_STRINGS_H +endif + ifdef HAVE_DEV_TTY BASIC_CFLAGS += -DHAVE_DEV_TTY endif diff --git a/configure.ac b/configure.ac index 66d0c91ece..e3ab6fe282 100644 --- a/configure.ac +++ b/configure.ac @@ -886,6 +886,12 @@ AC_CHECK_HEADER([libcharset.h], [HAVE_LIBCHARSET_H=YesPlease], [HAVE_LIBCHARSET_H=]) GIT_CONF_SUBST([HAVE_LIBCHARSET_H]) +# +# Define HAVE_STRINGS_H if you have strings.h +AC_CHECK_HEADER([strings.h], +[HAVE_STRINGS_H=YesPlease], +[HAVE_STRINGS_H=]) +GIT_CONF_SUBST([HAVE_STRINGS_H]) # Define CHARSET_LIB if libiconv does not export the locale_charset symbol # and libcharset does CHARSET_LIB= diff --git a/git-compat-util.h b/git-compat-util.h index ace154901f..d7359ef87f 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -99,7 +99,7 @@ #include #include #include -#ifdef __TANDEM /* or HAVE_STRINGS_H or !NO_STRINGS_H? */ +#ifdef HAVE_STRINGS_H #include /* for strcasecmp() */ #endif #include From b2d05e0653f29a75b57260c4d963d560ad65691b Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 18 Dec 2012 09:35:33 -0800 Subject: [PATCH 4/4] git-compat-util.h: do not #include by default Earlier we allowed platforms that lack not to include the header file from git-compat-util.h; we have included this header file since the early days back when we used MAXPATHLEN (which we no longer use) and also depended on it slurping ULONG_MAX (which we get by including stdint.h or inttypes.h these days). It turns out that we can compile our modern codebase just file without including it on many platforms (so far, Fedora, Debian, Ubuntu, MinGW, Mac OS X, Cygwin, HP-Nonstop, QNX and z/OS are reported to be OK). Let's stop including it by default, and on platforms that need it to be included, leave "make NEEDS_SYS_PARAM_H=YesPlease" as an escape hatch and ask them to report to us, so that we can find out about the real dependency and fix it in a more platform agnostic way. Signed-off-by: Junio C Hamano --- Makefile | 8 +++++--- configure.ac | 6 ------ git-compat-util.h | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 5cd1de02c7..2c1f04ff1a 100644 --- a/Makefile +++ b/Makefile @@ -167,7 +167,9 @@ all:: # Define NO_POLL if you do not have or don't want to use poll(). # This also implies NO_SYS_POLL_H. # -# Define NO_SYS_PARAM_H if you don't have sys/param.h. +# Define NEEDS_SYS_PARAM_H if you need to include sys/param.h to compile, +# *PLEASE* REPORT to git@vger.kernel.org if your platform needs this; +# we want to know more about the issue. # # Define NO_PTHREADS if you do not have or do not want to use Pthreads. # @@ -1747,8 +1749,8 @@ endif ifdef NO_SYS_POLL_H BASIC_CFLAGS += -DNO_SYS_POLL_H endif -ifdef NO_SYS_PARAM_H - BASIC_CFLAGS += -DNO_SYS_PARAM_H +ifdef NEEDS_SYS_PARAM_H + BASIC_CFLAGS += -DNEEDS_SYS_PARAM_H endif ifdef NO_INTTYPES_H BASIC_CFLAGS += -DNO_INTTYPES_H diff --git a/configure.ac b/configure.ac index e3ab6fe282..8fbb533d95 100644 --- a/configure.ac +++ b/configure.ac @@ -699,12 +699,6 @@ AC_CHECK_HEADER([sys/poll.h], [NO_SYS_POLL_H=UnfortunatelyYes]) GIT_CONF_SUBST([NO_SYS_POLL_H]) # -# Define NO_SYS_PARAM_H if you don't have sys/param.h -AC_CHECK_HEADER([sys/param.h], -[NO_SYS_PARAM_H=], -[NO_SYS_PARAM_H=UnfortunatelyYes]) -GIT_CONF_SUBST([NO_SYS_PARAM_H]) -# # Define NO_INTTYPES_H if you don't have inttypes.h AC_CHECK_HEADER([inttypes.h], [NO_INTTYPES_H=], diff --git a/git-compat-util.h b/git-compat-util.h index d7359ef87f..a88147b2dd 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -104,7 +104,7 @@ #endif #include #include -#ifndef NO_SYS_PARAM_H +#ifdef NEEDS_SYS_PARAM_H #include #endif #include