git-compat-util.h: do not #include <sys/param.h> by default

Earlier we allowed platforms that lack <sys/param.h> 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 <gitster@pobox.com>

Junio C Hamano committed Dec 18, 2012 at 09:35 UTC b2d05e0653f29a75b57260c4d963d560ad65691b
3 files changed +6 -10
Makefile
+5 -3
@@ -167,7 +167,9 @@ all::
167 # Define NO_POLL if you do not have or don't want to use poll().
168 # This also implies NO_SYS_POLL_H.
169 #
170 -# Define NO_SYS_PARAM_H if you don't have sys/param.h.
170 +# Define NEEDS_SYS_PARAM_H if you need to include sys/param.h to compile,
171 +# *PLEASE* REPORT to git@vger.kernel.org if your platform needs this;
172 +# we want to know more about the issue.
173 #
174 # Define NO_PTHREADS if you do not have or do not want to use Pthreads.
175 #
@@ -1747,8 +1749,8 @@ endif
1749 ifdef NO_SYS_POLL_H
1750 BASIC_CFLAGS += -DNO_SYS_POLL_H
1751 endif
1750 -ifdef NO_SYS_PARAM_H
1751 - BASIC_CFLAGS += -DNO_SYS_PARAM_H
1752 +ifdef NEEDS_SYS_PARAM_H
1753 + BASIC_CFLAGS += -DNEEDS_SYS_PARAM_H
1754 endif
1755 ifdef NO_INTTYPES_H
1756 BASIC_CFLAGS += -DNO_INTTYPES_H
configure.ac
-6
@@ -699,12 +699,6 @@ AC_CHECK_HEADER([sys/poll.h],
699 [NO_SYS_POLL_H=UnfortunatelyYes])
700 GIT_CONF_SUBST([NO_SYS_POLL_H])
701 #
702 -# Define NO_SYS_PARAM_H if you don't have sys/param.h
703 -AC_CHECK_HEADER([sys/param.h],
704 -[NO_SYS_PARAM_H=],
705 -[NO_SYS_PARAM_H=UnfortunatelyYes])
706 -GIT_CONF_SUBST([NO_SYS_PARAM_H])
707 -#
702 # Define NO_INTTYPES_H if you don't have inttypes.h
703 AC_CHECK_HEADER([inttypes.h],
704 [NO_INTTYPES_H=],
git-compat-util.h
+1 -1
@@ -104,7 +104,7 @@
104 #endif
105 #include <errno.h>
106 #include <limits.h>
107 -#ifndef NO_SYS_PARAM_H
107 +#ifdef NEEDS_SYS_PARAM_H
108 #include <sys/param.h>
109 #endif
110 #include <sys/types.h>