config.mak.uname: add sysinfo() configuration for cygwin

Although sysinfo() is a 'Linux only' function, cygwin provides an implementation which appears to be functional. The assumption that this function is Linux only is reflected in the way the HAVE_SYSINFO build variable is handled by the Makefile and config.mak.uname. Rework the setting of HAVE_SYSINFO in the Linux section of the system specific config file, along with the corresponding setting of the BASIC_CFLAGS in the Makefile. Add the setting of HAVE_SYSINFO to the cygwin section of 'config.mak.uname'. While here, add a test for the sysinfo() function to the autoconf build system. Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ramsay Jones committed Apr 17, 2025 at 00:18 UTC 50dec7c566d87838aaaa6017b5fb10b0f1cc8af7
3 files changed +14 -1
Makefile
+4
@@ -2168,6 +2168,10 @@ ifdef HAVE_SYNC_FILE_RANGE
2168 BASIC_CFLAGS += -DHAVE_SYNC_FILE_RANGE
2169 endif
2170
2171 +ifdef HAVE_SYSINFO
2172 + BASIC_CFLAGS += -DHAVE_SYSINFO
2173 +endif
2174 +
2175 ifdef HAVE_BSD_SYSCTL
2176 BASIC_CFLAGS += -DHAVE_BSD_SYSCTL
2177 endif
config.mak.uname
+2 -1
@@ -58,7 +58,7 @@ ifeq ($(uname_S),Linux)
58 HAVE_SYNC_FILE_RANGE = YesPlease
59 HAVE_GETDELIM = YesPlease
60 FREAD_READS_DIRECTORIES = UnfortunatelyYes
61 - BASIC_CFLAGS += -DHAVE_SYSINFO
61 + HAVE_SYSINFO = YesPlease
62 PROCFS_EXECUTABLE_PATH = /proc/self/exe
63 HAVE_PLATFORM_PROCINFO = YesPlease
64 COMPAT_OBJS += compat/linux/procinfo.o
@@ -253,6 +253,7 @@ ifeq ($(uname_O),Cygwin)
253 HAVE_GETDELIM = YesPlease
254 HAVE_CLOCK_GETTIME = YesPlease
255 HAVE_CLOCK_MONOTONIC = YesPlease
256 + HAVE_SYSINFO = YesPlease
257 HAVE_ALLOCA_H = YesPlease
258 NEEDS_LIBICONV = YesPlease
259 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
configure.ac
+8
@@ -1066,6 +1066,14 @@ AC_CHECK_LIB([iconv], [locale_charset],
1066 [AC_CHECK_LIB([charset], [locale_charset],
1067 [CHARSET_LIB=-lcharset])])
1068 GIT_CONF_SUBST([CHARSET_LIB])
1069 +
1070 +#
1071 +# Define HAVE_SYSINFO=YesPlease if sysinfo is available.
1072 +GIT_CHECK_FUNC(sysinfo,
1073 + [HAVE_SYSINFO=YesPlease],
1074 + [HAVE_SYSINFO=])
1075 +GIT_CONF_SUBST([HAVE_SYSINFO])
1076 +
1077 #
1078 # Define HAVE_CLOCK_GETTIME=YesPlease if clock_gettime is available.
1079 GIT_CHECK_FUNC(clock_gettime,