summaryrefslogtreecommitdiff
path: root/builtin/commit-graph.c
diff options
context:
space:
mode:
authorRamsay Jones <ramsay@ramsayjones.plus.com>2025-07-04 23:23:11 +0100
committerJunio C Hamano <gitster@pobox.com>2025-07-07 08:40:41 -0700
commit0c83bbc70412d96953b3b648fcea1a8fa15a5ca1 (patch)
tree5213a44730aa4ecb0b6036f36cc8a9e1557d2b43 /builtin/commit-graph.c
parent16bd9f20a403117f2e0d9bcda6c6e621d3763e77 (diff)
build: fix FreeBSD build when sysinfo compat library installed
Commit 50dec7c566 ("config.mak.uname: add sysinfo() configuration for cygwin", 2025-04-17) and later commit 187ce0222f ("configure.ac: upgrade to a compilation check for sysinfo", 2025-05-19) added a 'sysinfo()' check to the autoconf build. The FreeBSD system has an optional sysinfo compatibility library, used to assist in porting software, which causes the build to fail when it is installed. The reason for the failure is the lack of '-lsysinfo' during the linking step. Several solutions were considered: - add a 'linking' check to configure.ac in order to determine the need to link a separate library (-lsysinfo). (This would require a similar change to meson.build). - change the order of the preprocessor conditionals in the total_ram() function in 'builtin/gc.c', so that the *BSD sysctl() function (in the HAVE_BSD_SYSCTL block) takes priority over the sysinfo() function (in the HAVE_SYSINFO block). - suppress the setting of HAVE_SYSINFO when HAVE_BSD_SYSCTL has been defined (in both configure.ac and meson.build). The first solution above, while simple, adds unnecessary code (the sysinfo compat function is likely implemented using sysctl() anyway) when git is happy to use sysctl() on *BSD systems. The second solution would only be required by the autoconf and meson build systems, the Makefile already sets the build variables to the required values (since they are not 'auto-detected'). Here we opt for the final solution above, since it only requires that we prioritise the 'auto-detected' build variables in the autoconf and meson builds. In order to fix the FreeBSD build, move the sysinfo() check after the determination of the HAVE_BSD_SYSCTL build variable, suppressing the setting of HAVE_SYSINFO if HAVE_BSD_SYSCTL is defined. Apply this logic to both the configure.ac and meson.build file. [Thanks go to Renato Botelho <garga@FreeBSD.org> for testing this patch on FreeBSD.] Tested-by: Renato Botelho <garga@FreeBSD.org> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit-graph.c')
0 files changed, 0 insertions, 0 deletions