Re: Bug: build is broken on FreeBSD if libsysinfo is installed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/1/25 4:03 PM, Ramsay Jones wrote:

> The patch is below. (I didn't write a commit message ;) ).
> 
> Does this work for you?
> 
> ATB,
> Ramsay Jones
> 
> ---- >8 ----
> From: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxxx>
> Date: Tue, 1 Jul 2025 20:33:44 +0100
> Subject: [PATCH] build: fix FreeBSD sysinfo build failure
> 
> Signed-off-by: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxxx>
> ---
>  configure.ac | 61 ++++++++++++++++++++++++++++++----------------------
>  meson.build  | 10 +++++----
>  2 files changed, 41 insertions(+), 30 deletions(-)

> diff --git a/meson.build b/meson.build
> index 7fea4a34d6..355cad730c 100644
> --- a/meson.build
> +++ b/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>')
> @@ -1449,6 +1445,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>


This seems reasonable to me. has_member only does a compile-check, not
linkage, so we can't know if it's a BSD port. Only using it when a
previously checked interface can't be found, lets us avoid doing
extraneous work though.


-- 
Eli Schwartz

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux