git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] configure.ac: detect sysinfo

From
Jonas 'Sortie' Termansen <sortie@maxsi.org>
Date
Nov 5, 2024, 11:02 UTC
Message-ID
<0e949a77-0c49-4c06-9f47-d8455e9bb58f@maxsi.org>

This change helps cross-compilation from Linux systems by not assuming the host system has sysinfo(2) because it was built on Linux.

Signed-off-by: Jonas 'Sortie' Termansen <sortie@maxsi.org>
---
 Makefile         | 4 ++++
 config.mak.uname | 2 +-
 configure.ac     | 5 +++++
 3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 6f5986b66e..639760661c 100644
--- a/Makefile
+++ b/Makefile
@@ -2087,6 +2087,10 @@ ifdef HAVE_STRINGS_H
 	BASIC_CFLAGS += -DHAVE_STRINGS_H
 endif
 
+ifdef HAVE_SYSINFO
+	BASIC_CFLAGS += -DHAVE_SYSINFO
+endif
+
 ifdef HAVE_DEV_TTY
 	BASIC_CFLAGS += -DHAVE_DEV_TTY
 endif
diff --git a/config.mak.uname b/config.mak.uname
index d5112168a4..470b953581 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -59,7 +59,7 @@ ifeq ($(uname_S),Linux)
 	HAVE_SYNC_FILE_RANGE = YesPlease
 	HAVE_GETDELIM = YesPlease
 	FREAD_READS_DIRECTORIES = UnfortunatelyYes
-	BASIC_CFLAGS += -DHAVE_SYSINFO
+	HAVE_SYSINFO = YesPlease
 	PROCFS_EXECUTABLE_PATH = /proc/self/exe
 	HAVE_PLATFORM_PROCINFO = YesPlease
 	COMPAT_OBJS += compat/linux/procinfo.o
diff --git a/configure.ac b/configure.ac
index d1a96da14e..ea777644d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1164,6 +1164,11 @@ GIT_CHECK_FUNC(getdelim,
 [HAVE_GETDELIM=YesPlease],
 [HAVE_GETDELIM=])
 GIT_CONF_SUBST([HAVE_GETDELIM])
+# Define HAVE_SYSINFO if you have sysinfo in the C library.
+GIT_CHECK_FUNC(sysinfo,
+[HAVE_SYSINFO=YesPlease],
+[HAVE_SYSINFO=])
+GIT_CONF_SUBST([HAVE_SYSINFO])
 #
 #
 # Define NO_MMAP if you want to avoid mmap.
-- 
2.45.2
Message 1 of 1 in “configure.ac: detect sysinfo”
  1. configure.ac: detect sysinfoJonas 'Sortie' Termansen, Nov 5, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.