Merge branch 'rj/freebsd-sysinfo-build-fix'
Build fix for FreeBSD. * rj/freebsd-sysinfo-build-fix: build: fix FreeBSD build when sysinfo compat library installedmaint
commit
e78bca2eb7
61
configure.ac
61
configure.ac
|
@ -1067,32 +1067,6 @@ AC_CHECK_LIB([iconv], [locale_charset],
|
|||
[CHARSET_LIB=-lcharset])])
|
||||
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,
|
||||
|
@ -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.
|
||||
|
|
10
meson.build
10
meson.build
|
@ -1331,10 +1331,6 @@ if host_machine.system() != 'windows'
|
|||
endif
|
||||
endif
|
||||
|
||||
if compiler.has_member('struct sysinfo', 'totalram', prefix: '#include <sys/sysinfo.h>')
|
||||
libgit_c_args += '-DHAVE_SYSINFO'
|
||||
endif
|
||||
|
||||
if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>')
|
||||
libgit_c_args += '-DUSE_ST_TIMESPEC'
|
||||
elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>')
|
||||
|
@ -1438,6 +1434,12 @@ if compiler.has_header('sys/sysctl.h')
|
|||
endif
|
||||
endif
|
||||
|
||||
if not has_bsd_sysctl
|
||||
if compiler.has_member('struct sysinfo', 'totalram', prefix: '#include <sys/sysinfo.h>')
|
||||
libgit_c_args += '-DHAVE_SYSINFO'
|
||||
endif
|
||||
endif
|
||||
|
||||
if not meson.is_cross_build() and compiler.run('''
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
Loading…
Reference in New Issue