Skip to content

Commit b2d05e0

Browse files
committed
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 <[email protected]>
1 parent b3e103d commit b2d05e0

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ all::
167167
# Define NO_POLL if you do not have or don't want to use poll().
168168
# This also implies NO_SYS_POLL_H.
169169
#
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 [email protected] if your platform needs this;
172+
# we want to know more about the issue.
171173
#
172174
# Define NO_PTHREADS if you do not have or do not want to use Pthreads.
173175
#
@@ -1747,8 +1749,8 @@ endif
17471749
ifdef NO_SYS_POLL_H
17481750
BASIC_CFLAGS += -DNO_SYS_POLL_H
17491751
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
17521754
endif
17531755
ifdef NO_INTTYPES_H
17541756
BASIC_CFLAGS += -DNO_INTTYPES_H

configure.ac

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -699,12 +699,6 @@ AC_CHECK_HEADER([sys/poll.h],
699699
[NO_SYS_POLL_H=UnfortunatelyYes])
700700
GIT_CONF_SUBST([NO_SYS_POLL_H])
701701
#
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-
#
708702
# Define NO_INTTYPES_H if you don't have inttypes.h
709703
AC_CHECK_HEADER([inttypes.h],
710704
[NO_INTTYPES_H=],

git-compat-util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
#endif
105105
#include <errno.h>
106106
#include <limits.h>
107-
#ifndef NO_SYS_PARAM_H
107+
#ifdef NEEDS_SYS_PARAM_H
108108
#include <sys/param.h>
109109
#endif
110110
#include <sys/types.h>

0 commit comments

Comments
 (0)