diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-07-14 11:19:28 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-07-14 11:19:28 -0700 |
| commit | e78bca2eb79cb209151be4b8530fdea0bf0d5865 (patch) | |
| tree | 2c1208bd8bcf188db586bd28be2bae1163361942 /configure.ac | |
| parent | 8c5f7db806a9721112fd19596439469480ca94df (diff) | |
| parent | 0c83bbc70412d96953b3b648fcea1a8fa15a5ca1 (diff) | |
| download | git-e78bca2eb79cb209151be4b8530fdea0bf0d5865.tar.xz | |
Merge branch 'rj/freebsd-sysinfo-build-fix'
Build fix for FreeBSD.
* rj/freebsd-sysinfo-build-fix:
build: fix FreeBSD build when sysinfo compat library installed
Diffstat (limited to 'configure.ac')
| -rw-r--r-- | configure.ac | 61 |
1 files changed, 35 insertions, 26 deletions
diff --git a/configure.ac b/configure.ac index d1b78305f1..cfb50112bf 100644 --- a/configure.ac +++ b/configure.ac @@ -1068,32 +1068,6 @@ AC_CHECK_LIB([iconv], [locale_charset], GIT_CONF_SUBST([CHARSET_LIB]) # -# Define HAVE_SYSINFO=YesPlease if sysinfo is available. -# -AC_DEFUN([HAVE_SYSINFO_SRC], [ -AC_LANG_PROGRAM([[ -#include <stdint.h> -#include <sys/sysinfo.h> -]], [[ -struct sysinfo si; -uint64_t t = 0; -if (!sysinfo(&si)) { - t = si.totalram; - if (si.mem_unit > 1) - t *= (uint64_t)si.mem_unit; -} -return t; -]])]) - -AC_MSG_CHECKING([for sysinfo]) -AC_COMPILE_IFELSE([HAVE_SYSINFO_SRC], - [AC_MSG_RESULT([yes]) - HAVE_SYSINFO=YesPlease], - [AC_MSG_RESULT([no]) - HAVE_SYSINFO=]) -GIT_CONF_SUBST([HAVE_SYSINFO]) - -# # Define HAVE_CLOCK_GETTIME=YesPlease if clock_gettime is available. GIT_CHECK_FUNC(clock_gettime, [HAVE_CLOCK_GETTIME=YesPlease], @@ -1213,6 +1187,41 @@ AC_COMPILE_IFELSE([BSD_SYSCTL_SRC], HAVE_BSD_SYSCTL=]) GIT_CONF_SUBST([HAVE_BSD_SYSCTL]) +# +# Define HAVE_SYSINFO=YesPlease if sysinfo is available. +# + +HAVE_SYSINFO= +# on a *BSD system, sysctl() takes precedence over the +# sysinfo() compatibility library (if installed). + +if test -z "$HAVE_BSD_SYSCTL"; then + + AC_DEFUN([HAVE_SYSINFO_SRC], [ + AC_LANG_PROGRAM([[ + #include <stdint.h> + #include <sys/sysinfo.h> + ]], [[ + struct sysinfo si; + uint64_t t = 0; + if (!sysinfo(&si)) { + t = si.totalram; + if (si.mem_unit > 1) + t *= (uint64_t)si.mem_unit; + } + return t; + ]])]) + + AC_MSG_CHECKING([for sysinfo]) + AC_COMPILE_IFELSE([HAVE_SYSINFO_SRC], + [AC_MSG_RESULT([yes]) + HAVE_SYSINFO=YesPlease], + [AC_MSG_RESULT([no]) + HAVE_SYSINFO=]) + GIT_CONF_SUBST([HAVE_SYSINFO]) + +fi + ## Other checks. # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link. # Enable it on Windows. By default, symrefs are still used. |
